1717 steps :
1818 - id : set-matrix
1919 run : |
20- if [[ "${{ github.base_ref }}" == "develop" ]]; then
21- echo "matrix_os=[\"ubuntu-latest\"]" >> $GITHUB_OUTPUT
20+ if [[ "${{ github.event_name }}" == "pull_request" && "${{ github. base_ref }}" == "develop" ]]; then
21+ echo "matrix_os=[\"ubuntu-latest\"]" >> $GITHUB_OUTPUT
2222 else
2323 echo "matrix_os=[\"windows-latest\", \"ubuntu-latest\", \"macos-latest\"]" >> $GITHUB_OUTPUT
2424 fi
@@ -107,14 +107,14 @@ jobs:
107107 miniconda-version : ' latest'
108108 auto-update-conda : true
109109 activate-environment : TEST
110- python-version : ${{ matrix.python-version }}
110+ python-version : ${{ env.PYTHON_VER }}
111111 use-only-tar-bz2 : true
112112
113113 - name : Setup Conda environment
114114 shell : bash -l {0}
115115 run : |
116116 conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4 coverage --strict-channel-priority
117- pip install -e . --no-deps -- force-reinstall
117+ pip install -e . --force-reinstall
118118
119119 - name : Install dependencies
120120 shell : bash -l {0}
@@ -149,7 +149,7 @@ jobs:
149149 miniconda-version : ' latest'
150150 auto-update-conda : true
151151 activate-environment : TEST
152- python-version : ${{ matrix.python-version }}
152+ python-version : ${{ env.PYTHON_VER }}
153153 use-only-tar-bz2 : true
154154
155155 - name : Setup Conda environment
@@ -195,41 +195,36 @@ jobs:
195195 with :
196196 miniconda-version : ' latest'
197197 auto-update-conda : true
198+ environment-file : environment.yml
198199 activate-environment : TEST
199200 python-version : ${{ matrix.python-version }}
200- use-only-tar-bz2 : true
201+ use-only-tar-bz2 : false
201202
202203 - name : Create and setup Conda environment
203204 shell : bash -l {0}
204205 run : |
205- conda install numpy cython pip hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
206- pip install -e . --no-deps --force-reinstall
207-
208- - name : Install dependencies
209- shell : bash -l {0}
210- run : |
211- python -m pip install --upgrade pip wheel
212- pip install coverage pytest coveralls .
206+ conda install -c conda-forge pytest coverage=7.5.0 coveralls --strict-channel-priority
207+ pip install -e . --force-reinstall
213208
214209 - name : Download data from artifact
215210 uses : actions/download-artifact@v4
216211 with :
217212 name : data
218213 path : ~/.cache/mhkit
219214
220- - name : Run pytest
215+ - name : Run pytest & generate coverage report
221216 shell : bash -l {0}
222217 run : |
223218 coverage run --rcfile=.github/workflows/.coveragerc --source=./mhkit/ -m pytest -c .github/workflows/pytest.ini
219+ coverage lcov
224220
225221 - name : Upload coverage data to coveralls.io
226- shell : bash -l {0}
227- run : |
228- coveralls --service=github
229- env :
230- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
231- COVERALLS_FLAG_NAME : ${{ matrix.python-version }}
232- COVERALLS_PARALLEL : true
222+ uses : coverallsapp/github-action@master
223+ with :
224+ github-token : ${{ secrets.GITHUB_TOKEN }}
225+ flag-name : ${{ matrix.python-version }}
226+ parallel : true
227+ path-to-lcov : ./coverage.lcov
233228
234229 pip-build :
235230 name : pip-${{ matrix.os }}/${{ matrix.python-version }}
@@ -249,6 +244,21 @@ jobs:
249244 with :
250245 python-version : ${{ matrix.python-version }}
251246
247+ - name : Install HDF5 (macOS with Python 3.8)
248+ if : startsWith(runner.os, 'macOS') && matrix.python-version == '3.8'
249+ run : brew install hdf5
250+
251+ - name : Install NetCDF (macOS with Python 3.8)
252+ if : startsWith(runner.os, 'macOS') && matrix.python-version == '3.8'
253+ run : brew install netcdf
254+
255+ - name : Set environment variables (macOS with Python 3.8)
256+ if : startsWith(runner.os, 'macOS') && matrix.python-version == '3.8'
257+ run : |
258+ echo "HDF5_DIR=$(brew --prefix hdf5)" >> $GITHUB_ENV
259+ echo "NETCDF4_DIR=$(brew --prefix netcdf)" >> $GITHUB_ENV
260+ echo "PKG_CONFIG_PATH=$(brew --prefix hdf5)/lib/pkgconfig:$(brew --prefix netcdf)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
261+
252262 - name : Set up Git repository
253263 uses : actions/checkout@v4
254264
@@ -264,17 +274,19 @@ jobs:
264274 python -m pip install --upgrade pip wheel
265275 pip install coverage pytest coveralls .
266276
267- - name : Run pytest
277+ - name : Run pytest & generate coverage report
268278 shell : bash -l {0}
269279 run : |
270- coverage run --rcfile=.github/workflows/.coveragerc --source=./mhkit/ -m pytest -c .github/workflows/pytest.ini
280+ coverage run --rcfile=.github/workflows/.coveragerc --source=./mhkit/ -m pytest -c .github/workflows/pytest.ini
281+ coverage lcov
271282
272283 - name : Upload coverage data to coveralls.io
273- run : coveralls --service=github
274- env :
275- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
276- COVERALLS_FLAG_NAME : ${{ matrix.python-version }}
277- COVERALLS_PARALLEL : true
284+ uses : coverallsapp/github-action@master
285+ with :
286+ github-token : ${{ secrets.GITHUB_TOKEN }}
287+ flag-name : ${{ matrix.python-version }}
288+ parallel : true
289+ path-to-lcov : ./coverage.lcov
278290
279291 hindcast-calls :
280292 name : hindcast-${{ matrix.os }}/${{ matrix.python-version }}
@@ -338,15 +350,15 @@ jobs:
338350 python -m pip install --upgrade pip wheel
339351 pip install coveralls .
340352 coverage run --rcfile=.github/workflows/.coveragehindcastrc -m pytest -c .github/workflows/pytest-hindcast.ini
353+ coverage lcov
341354
342355 - name : Upload coverage data to coveralls.io
343- shell : bash -l {0}
344- run : |
345- coveralls --service=github
346- env :
347- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
348- COVERALLS_FLAG_NAME : ${{ matrix.python-version }}
349- COVERALLS_PARALLEL : true
356+ uses : coverallsapp/github-action@master
357+ with :
358+ github-token : ${{ secrets.GITHUB_TOKEN }}
359+ flag-name : ${{ matrix.python-version }}
360+ parallel : true
361+ path-to-lcov : ./coverage.lcov
350362
351363 coveralls :
352364 name : Indicate completion to coveralls.io
0 commit comments