-
Notifications
You must be signed in to change notification settings - Fork 8
301 lines (259 loc) · 8.42 KB
/
ci.yml
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: GW3099 continuous integration
on:
# run at 6 AM UTC every day
schedule:
- cron: '0 6 * * *'
push:
branches:
- main
paths-ignore:
- '**.md'
- '.gitignore'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- '.gitignore'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install ruff
run: pip install ruff
- name: Lint
run: ruff check .
- name: Check format
run: ruff format . --check
install_env_linux:
name: Install gw3099 environment on linux
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: apt install
run: |
sudo apt install build-essential
sudo apt-get install -y petsc-dev netcdf-bin libnetcdf-dev libnetcdff-dev openmpi-bin libopenmpi-dev
- name: Update package config files
working-directory: .scripts
run: |
python update_pc_files.py
- name: netcdf-fortran settings
run: |
pkg-config --libs-only-L netcdf-fortran
pkg-config --cflags-only-I netcdf-fortran
nf-config --all
- name: Update environment file
working-directory: .scripts
run: |
python update_env_file.py
cat ../environment.yml
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: "environment.yml"
activate-environment: "gw3099"
auto-activate-base: false
- name: Update flopy mf6 classes
run: |
python -m flopy.mf6.utils.generate_classes --ref 'develop'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clone MODFLOW repo
run: |
git clone --depth 1 --branch develop https://github.com/MODFLOW-USGS/modflow6.git
- name: Build extended version of MODFLOW
if: runner.os != 'Windows'
working-directory: modflow6
run: |
FC=mpifort CC=mpicc meson setup builddir -Ddebug=false -Dextended=true --prefix=$CONDA_PREFIX --libdir=bin
meson install -C builddir
meson test --verbose --no-rebuild -C builddir
- name: OpenGL workaround on Linux
if: runner.os == 'Linux'
run: |
# referenced from https://github.com/pyvista/pyvista/blob/main/.github/workflows/vtk-pre-test.yml#L53
conda uninstall -y vtk
pip install --extra-index-url https://wheels.vtk.org trame vtk-osmesa
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Test notebooks
working-directory: .scripts
run: |
python test_notebooks.py --script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
install_env:
name: Install gw3099 environment
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "windows-latest", "ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Update environment file
working-directory: .scripts
run: |
python update_env_file.py --conda
cat ../environment.yml
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: "environment.yml"
activate-environment: "gw3099"
auto-activate-base: false
- name: Update flopy mf6 classes
run: |
python -m flopy.mf6.utils.generate_classes --ref 'develop'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: netcdf-fortran settings
if: runner.os != 'Windows'
run: |
pkg-config --libs-only-L netcdf-fortran
pkg-config --cflags-only-I netcdf-fortran
nf-config --help
- name: Update package config files
if: (runner.os != 'Windows')
working-directory: .scripts
run: |
python update_pc_files.py
- name: Clone MODFLOW repo
run: |
git clone --depth 1 --branch develop https://github.com/MODFLOW-USGS/modflow6.git
- name: Build extended version of MODFLOW
if: runner.os != 'Windows'
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false -Dextended=true --prefix=$CONDA_PREFIX --libdir=bin
meson install -C builddir
meson test --verbose --no-rebuild -C builddir
- name: Get and test parallel MODFLOW on Windows
if: runner.os == 'Windows'
working-directory: modflow6/.mf6minsim
run: |
get-modflow --repo modflow6-nightly-build --ostag win64par :python
mpiexec -n 1 mf6 -p
mpiexec -n 2 mf6 -p
- name: OpenGL workaround on Linux
if: runner.os == 'Linux'
run: |
# referenced from https://github.com/pyvista/pyvista/blob/main/.github/workflows/vtk-pre-test.yml#L53
conda uninstall -y vtk
pip install --extra-index-url https://wheels.vtk.org trame vtk-osmesa
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Test notebooks
working-directory: .scripts
run: |
python test_notebooks.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
install_vizenv:
name: Install viz environment
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: 'environment-viz.yml'
activate-environment: 'gw3099viz'
auto-activate-base: false
pywatershed:
name: test pywatershed notebooks
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "windows-latest", "ubuntu-latest"]
python-version: ["3.10", "3.11"]
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
# - name: Setup gfortran
# uses: fortran-lang/setup-fortran@v1
# with:
# compiler: gcc
# version: 11
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-pywatershed.yml
cache-environment: true
cache-downloads: true
# - name: Install miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# python-version: ${{ matrix.python-version }}
# environment-file: "environment-pywatershed.yml"
# activate-environment: "gw3099pws"
# auto-activate-base: false
- name: Install pywatershed
working-directory: exercises/pywatershed
run: |
git clone https://github.com/EC-USGS/pywatershed.git
cd pywatershed
git checkout feat_gw3099
pip install -e .
- name: Import pywatershed
run: |
python -c "import pywatershed"
# - name: Get GIS files for tests
# run: |
# python pywatershed/utils/gis_files.py
# - name: Get additional domain files for notebooks
# run: |
# python pywatershed/utils/addtl_domain_files.py
- name: Test notebooks
working-directory: .scripts
run: |
python test_notebooks.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}