|
10 | 10 | - master |
11 | 11 | - develop |
12 | 12 | jobs: |
| 13 | + check-changes: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + wave_io_hindcast_changed: ${{ steps.changes.outputs.wave_io_hindcast }} |
| 17 | + should-run-hindcast: ${{ steps.hindcast-logic.outputs.should-run-hindcast }} |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Check for changes in wave/io/hindcast |
| 23 | + id: changes |
| 24 | + uses: dorny/paths-filter@v2 |
| 25 | + with: |
| 26 | + filters: | |
| 27 | + wave_io_hindcast: |
| 28 | + - 'mhkit/tests/wave/io/hindcast/**' |
| 29 | +
|
| 30 | + - id: hindcast-logic |
| 31 | + run: | |
| 32 | + if [[ "${{ github.event.pull_request.base.ref }}" == "master" || "${{ steps.changes.outputs.wave_io_hindcast }}" == "true" ]]; then |
| 33 | + echo "::set-output name=should-run-hindcast::true" |
| 34 | + else |
| 35 | + echo "::set-output name=should-run-hindcast::false" |
| 36 | + fi |
| 37 | +
|
13 | 38 | prepare-cache: |
| 39 | + needs: [check-changes] |
14 | 40 | runs-on: ubuntu-latest |
15 | 41 | env: |
16 | 42 | PYTHON_VER: 3.9 |
@@ -41,11 +67,16 @@ jobs: |
41 | 67 |
|
42 | 68 | - name: Prepare data |
43 | 69 | run: | |
44 | | - # pytest tests/test_specific_file.py::TestClass::test_function |
45 | 70 | source activate TEST |
46 | 71 | pytest mhkit/tests/river/test_io.py |
47 | 72 | pytest mhkit/tests/tidal/test_io.py |
48 | 73 | pytest mhkit/tests/wave/io/test_cdip.py |
| 74 | +
|
| 75 | + - name: Prepare Hindcast data |
| 76 | + if: (needs.check-changes.outputs.should-run-hindcast == 'true') |
| 77 | + run: | |
| 78 | + # pytest tests/test_specific_file.py::TestClass::test_function |
| 79 | + source activate TEST |
49 | 80 | pytest mhkit/tests/wave/io/hindcast/test_hindcast.py |
50 | 81 | pytest mhkit/tests/wave/io/hindcast/test_wind_toolkit.py |
51 | 82 |
|
@@ -158,7 +189,9 @@ jobs: |
158 | 189 |
|
159 | 190 | hindcast-calls: |
160 | 191 | name: hindcast-${{ matrix.os }}/${{ matrix.python-version }} |
161 | | - needs: [prepare-cache] |
| 192 | + needs: [check-changes, prepare-cache] |
| 193 | + if: (needs.check-changes.outputs.should-run-hindcast == 'true') |
| 194 | + |
162 | 195 | runs-on: ${{ matrix.os }} |
163 | 196 | strategy: |
164 | 197 | max-parallel: 1 |
@@ -211,6 +244,11 @@ jobs: |
211 | 244 | coveralls: |
212 | 245 | name: Indicate completion to coveralls.io |
213 | 246 | needs: [conda-build, pip-build, hindcast-calls] |
| 247 | + if: | |
| 248 | + always() && |
| 249 | + needs.conda-build.result == 'success' && |
| 250 | + needs.pip-build.result == 'success' && |
| 251 | + (needs.hindcast-calls.result == 'success' || needs.hindcast-calls.result == 'skipped') |
214 | 252 | runs-on: ubuntu-latest |
215 | 253 | container: python:3-slim |
216 | 254 | steps: |
|
0 commit comments