@@ -30,14 +30,15 @@ jobs:
3030 should-run-hindcast : ${{ steps.hindcast-logic.outputs.should-run-hindcast }}
3131 steps :
3232 - name : Checkout code
33- uses : actions/checkout@v3
33+ uses : actions/checkout@v4
3434
3535 - name : Check for changes in wave/io/hindcast
3636 id : changes
37- uses : dorny/paths-filter@v2
37+ uses : dorny/paths-filter@v3
3838 with :
3939 filters : |
4040 wave_io_hindcast:
41+ - 'mhkit/wave/io/hindcast/**'
4142 - 'mhkit/tests/wave/io/hindcast/**'
4243
4344 - id : hindcast-logic
@@ -48,14 +49,13 @@ jobs:
4849 echo "should-run-hindcast=false" >> "$GITHUB_OUTPUT"
4950 fi
5051
51- prepare-cache :
52- needs : [check-changes]
52+ prepare-nonhindcast-cache :
5353 runs-on : ubuntu-latest
5454 env :
5555 PYTHON_VER : 3.9
5656 steps :
5757 - name : Checkout code
58- uses : actions/checkout@v3
58+ uses : actions/checkout@v4
5959
6060 - name : Setup Conda
6161 uses : s-weigand/setup-conda@v1
6868 run : |
6969 conda create --name TEST python=${{ env.PYTHON_VER }} numpy cython pip hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
7070 source activate TEST
71- export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
71+ export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH"
7272 pip install -e . --no-deps --force-reinstall
7373
7474 - name : Install dependencies
@@ -78,30 +78,106 @@ jobs:
7878 python -m pip install --upgrade pip wheel
7979 pip install coverage pytest coveralls .
8080
81- - name : Prepare data
81+ - name : Prepare non-hindcast API data
8282 run : |
8383 source activate TEST
8484 pytest mhkit/tests/river/test_io_usgs.py
8585 pytest mhkit/tests/tidal/test_io.py
8686 pytest mhkit/tests/wave/io/test_cdip.py
8787
88- - name : Prepare Hindcast data
89- if : (needs.check-changes.outputs.should-run-hindcast == 'true')
88+ - name : Upload data as artifact
89+ uses : actions/upload-artifact@v4
90+ with :
91+ name : data
92+ path : ~/.cache/mhkit
93+
94+ prepare-wave-hindcast-cache :
95+ needs : [check-changes]
96+ runs-on : ubuntu-latest
97+ env :
98+ PYTHON_VER : 3.9
99+ if : (needs.check-changes.outputs.should-run-hindcast == 'true')
100+ steps :
101+ - name : Checkout code
102+ uses : actions/checkout@v4
103+
104+ - name : Setup Conda
105+ uses : s-weigand/setup-conda@v1
106+ with :
107+ activate-conda : false
108+ conda-channels : conda-forge
109+
110+ - name : Python setup
111+ shell : bash -l {0}
112+ run : |
113+ conda create --name TEST python=${{ env.PYTHON_VER }} numpy cython pip hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
114+ source activate TEST
115+ export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH"
116+ pip install -e . --no-deps --force-reinstall
117+
118+ - name : Install dependencies
119+ shell : bash -l {0}
120+ run : |
121+ source activate TEST
122+ python -m pip install --upgrade pip wheel
123+ pip install coverage pytest coveralls .
124+
125+ - name : Prepare Wave Hindcast data
90126 run : |
91- # pytest tests/test_specific_file.py::TestClass::test_function
92127 source activate TEST
93128 pytest mhkit/tests/wave/io/hindcast/test_hindcast.py
129+
130+ - name : Upload Wave Hindcast data as artifact
131+ uses : actions/upload-artifact@v4
132+ with :
133+ name : wave-hindcast-data
134+ path : ~/.cache/mhkit
135+
136+ prepare-wind-hindcast-cache :
137+ needs : [check-changes]
138+ runs-on : ubuntu-latest
139+ env :
140+ PYTHON_VER : 3.9
141+ if : (needs.check-changes.outputs.should-run-hindcast == 'true')
142+ steps :
143+ - name : Checkout code
144+ uses : actions/checkout@v4
145+
146+ - name : Setup Conda
147+ uses : s-weigand/setup-conda@v1
148+ with :
149+ activate-conda : false
150+ conda-channels : conda-forge
151+
152+ - name : Python setup
153+ shell : bash -l {0}
154+ run : |
155+ conda create --name TEST python=${{ env.PYTHON_VER }} numpy cython pip hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
156+ source activate TEST
157+ export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH"
158+ pip install -e . --no-deps --force-reinstall
159+
160+ - name : Install dependencies
161+ shell : bash -l {0}
162+ run : |
163+ source activate TEST
164+ python -m pip install --upgrade pip wheel
165+ pip install coverage pytest coveralls .
166+
167+ - name : Prepare Wind Hindcast data
168+ run : |
169+ source activate TEST
94170 pytest mhkit/tests/wave/io/hindcast/test_wind_toolkit.py
95171
96- - name : Upload data as artifact
97- uses : actions/upload-artifact@v3
172+ - name : Upload Wind Hindcast data as artifact
173+ uses : actions/upload-artifact@v4
98174 with :
99- name : data
175+ name : wind-hindcast- data
100176 path : ~/.cache/mhkit
101177
102178 conda-build :
103179 name : conda-${{ matrix.os }}/${{ matrix.python-version }}
104- needs : [set-os, prepare-cache]
180+ needs : [set-os, prepare-nonhindcast- cache]
105181 runs-on : ${{ matrix.os }}
106182 strategy :
107183 fail-fast : false
@@ -112,7 +188,7 @@ jobs:
112188 PYTHON_VER : ${{ matrix.python-version }}
113189
114190 steps :
115- - uses : actions/checkout@v3
191+ - uses : actions/checkout@v4
116192
117193 - name : Setup Conda
118194 uses : s-weigand/setup-conda@v1
@@ -136,7 +212,7 @@ jobs:
136212 pip install coverage pytest coveralls .
137213
138214 - name : Download data from artifact
139- uses : actions/download-artifact@v3
215+ uses : actions/download-artifact@v4
140216 with :
141217 name : data
142218 path : ~/.cache/mhkit
@@ -159,7 +235,7 @@ jobs:
159235
160236 pip-build :
161237 name : pip-${{ matrix.os }}/${{ matrix.python-version }}
162- needs : [set-os, prepare-cache]
238+ needs : [set-os, prepare-nonhindcast- cache]
163239 runs-on : ${{ matrix.os }}
164240 strategy :
165241 fail-fast : false
@@ -168,18 +244,18 @@ jobs:
168244 python-version : ['3.8', '3.9', '3.10', '3.11']
169245
170246 steps :
171- - uses : conda-incubator/setup-miniconda@v2
247+ - uses : conda-incubator/setup-miniconda@v3
172248
173249 - name : Set up Python ${{ matrix.python-version }}
174- uses : actions/setup-python@v3
250+ uses : actions/setup-python@v5
175251 with :
176252 python-version : ${{ matrix.python-version }}
177253
178254 - name : Set up Git repository
179- uses : actions/checkout@v3
255+ uses : actions/checkout@v4
180256
181257 - name : Download data from artifact
182- uses : actions/download-artifact@v3
258+ uses : actions/download-artifact@v4
183259 with :
184260 name : data
185261 path : ~/.cache/mhkit
@@ -202,7 +278,13 @@ jobs:
202278
203279 hindcast-calls :
204280 name : hindcast-${{ matrix.os }}/${{ matrix.python-version }}
205- needs : [check-changes, prepare-cache, set-os]
281+ needs :
282+ [
283+ check-changes,
284+ prepare-wave-hindcast-cache,
285+ prepare-wind-hindcast-cache,
286+ set-os,
287+ ]
206288 if : (needs.check-changes.outputs.should-run-hindcast == 'true')
207289
208290 runs-on : ${{ matrix.os }}
@@ -214,7 +296,7 @@ jobs:
214296 python-version : ['3.8', '3.9', '3.10', '3.11']
215297
216298 steps :
217- - uses : actions/checkout@v3
299+ - uses : actions/checkout@v4
218300
219301 - name : Setup Conda
220302 uses : s-weigand/setup-conda@v1
@@ -230,11 +312,24 @@ jobs:
230312 export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
231313 pip install -e . --no-deps --force-reinstall
232314
233- - name : Download data from artifact
234- uses : actions/download-artifact@v3
315+ - name : Download Wave Hindcast data from artifact
316+ uses : actions/download-artifact@v4
235317 with :
236- name : data
237- path : ~/.cache/mhkit
318+ name : wave-hindcast-data
319+ path : ~/.cache/mhkit/wave-hindcast
320+
321+ - name : Download Wind Hindcast data from artifact
322+ uses : actions/download-artifact@v4
323+ with :
324+ name : wind-hindcast-data
325+ path : ~/.cache/mhkit/wind-hindcast
326+
327+ - name : Consolidate hindcast data
328+ run : |
329+ mkdir -p ~/.cache/mhkit/hindcast
330+ mv ~/.cache/mhkit/wave-hindcast/hindcast/* ~/.cache/mhkit/hindcast/
331+ mv ~/.cache/mhkit/wind-hindcast/hindcast/* ~/.cache/mhkit/hindcast/
332+ shell : bash
238333
239334 - name : Install MHKiT and run pytest
240335 shell : bash -l {0}
0 commit comments