-
Notifications
You must be signed in to change notification settings - Fork 20
159 lines (137 loc) · 4.62 KB
/
Copy pathfmu-tools.yml
File metadata and controls
159 lines (137 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: fmu-tools
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
# Run CI every night and check that tests are working with latest dependencies
- cron: "0 0 * * *"
permissions: {}
jobs:
fmu-tools:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
permissions:
contents: write # For docs
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install requirements
if: ${{ always() }}
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
uv sync --all-extras --upgrade
else
uv sync --all-extras --frozen
fi
- name: List all installed packages
if: ${{ always() }}
run: uv pip freeze
- name: Ruff check
if: ${{ always() }}
run: uv run ruff check .
- name: Ruff format check
if: ${{ always() }}
run: uv run ruff format . --check
- name: Enforce static typing
if: ${{ always() }}
run: uv run mypy src/fmu/tools tests --exclude 'tests/rms/rename_rms_scripts_data/'
- name: Run tests
if: ${{ always() }}
run: |
git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata
uv run pytest -n auto tests --disable-warnings
- name: Syntax check on documentation
if: ${{ always() }}
run: uv run rstcheck -r docs
- name: Build documentation
if: ${{ always() }}
run: |
uv run sphinx-apidoc -f -H "API for fmu.tools" -o docs src
uv run sphinx-build -W -b html docs build/docs/html
- name: Update GitHub pages
if: |
github.repository_owner == 'equinor' && github.ref == 'refs/heads/main' &&
matrix.python-version == '3.11'
run: |
cp -R ./build/docs/html ../html
git checkout -- uv.lock
git config --local user.email "fmu-tools-github-action"
git config --local user.name "fmu-tools-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x # Double -f is intentional.
git rm -r *
cp -R ../html/* .
touch .nojekyll # If not, github pages ignores _* directories.
git add .
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi
rms:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: false
matrix:
config:
- {
name: "RMS 14.2",
os: ubuntu-latest,
python: 3.11.3,
pip: 23.3.1,
wheel: 0.37.1,
setuptools: 63.4.3,
matplotlib: 3.7.1,
numpy: 1.24.3,
pandas: 2.0.2,
scipy: 1.10.1,
}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.config.python }}
- name: Install packages
run: |
pip install pip==${{ matrix.config.pip }}
pip install ".[tests]"
pip install \
wheel==${{ matrix.config.wheel }} \
setuptools==${{ matrix.config.setuptools }} \
matplotlib==${{ matrix.config.matplotlib }} \
numpy==${{ matrix.config.numpy }} \
pandas==${{ matrix.config.pandas }} \
scipy==${{ matrix.config.scipy }}
- name: List dependencies
run: pip freeze
- name: Run tests
if: ${{ always() }}
run: |
git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata
pytest -n auto tests --disable-warnings