Skip to content

Commit f9be764

Browse files
committed
Add all_tests job to be used as single requirement
1 parent 09dc9d0 commit f9be764

File tree

1 file changed

+55
-16
lines changed

1 file changed

+55
-16
lines changed

.github/workflows/tests.yml

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,10 @@ name: tests
22

33
on:
44
pull_request:
5-
paths:
6-
- ".github/workflows/tests.yml"
7-
- "pymc/**.py"
8-
- "*.py"
9-
- "conda-envs/**"
10-
- "codecov.yml"
11-
- "requirements*.txt"
12-
- "scripts/*.sh"
135
push:
14-
branches: [main]
15-
paths:
16-
- ".github/workflows/tests.yml"
17-
- "pymc/**.py"
18-
- "*.py"
19-
- "conda-envs/**"
20-
- "codecov.yml"
21-
- "scripts/*.sh"
6+
branches:
7+
- main
8+
229

2310
# Tests are split into multiple jobs to accelerate the CI.
2411
# Different jobs should be organized to take approximately the same
@@ -30,7 +17,33 @@ on:
3017
# enforces that test run just once per OS / floatX setting.
3118

3219
jobs:
20+
21+
changes:
22+
name: "Check for changes"
23+
runs-on: ubuntu-latest
24+
outputs:
25+
changes: ${{ steps.changes.outputs.src }}
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
- uses: dorny/paths-filter@v2
31+
id: changes
32+
with:
33+
filters: |
34+
src:
35+
- ".github/workflows/tests.yml"
36+
- "pymc/**.py"
37+
- "tests/**.py"
38+
- "*.py"
39+
- "conda-envs/**"
40+
- "requirements*.txt"
41+
- "codecov.yml"
42+
- "scripts/*.sh"
43+
3344
ubuntu:
45+
needs: changes
46+
if: ${{ needs.changes.outputs.changes == 'true' }}
3447
strategy:
3548
matrix:
3649
os: [ubuntu-20.04]
@@ -160,7 +173,10 @@ jobs:
160173
env_vars: TEST_SUBSET
161174
name: ${{ matrix.os }} ${{ matrix.floatx }}
162175
fail_ci_if_error: false
176+
163177
windows:
178+
needs: changes
179+
if: ${{ needs.changes.outputs.changes == 'true' }}
164180
strategy:
165181
matrix:
166182
os: [windows-latest]
@@ -233,7 +249,10 @@ jobs:
233249
env_vars: TEST_SUBSET
234250
name: ${{ matrix.os }} ${{ matrix.floatx }}
235251
fail_ci_if_error: false
252+
236253
macos:
254+
needs: changes
255+
if: ${{ needs.changes.outputs.changes == 'true' }}
237256
strategy:
238257
matrix:
239258
os: [macos-latest]
@@ -309,7 +328,10 @@ jobs:
309328
env_vars: TEST_SUBSET
310329
name: ${{ matrix.os }} ${{ matrix.floatx }}
311330
fail_ci_if_error: false
331+
312332
external_samplers:
333+
needs: changes
334+
if: ${{ needs.changes.outputs.changes == 'true' }}
313335
strategy:
314336
matrix:
315337
os: [ubuntu-20.04]
@@ -379,7 +401,10 @@ jobs:
379401
env_vars: TEST_SUBSET
380402
name: JAX tests - ${{ matrix.os }} ${{ matrix.floatx }}
381403
fail_ci_if_error: false
404+
382405
float32:
406+
needs: changes
407+
if: ${{ needs.changes.outputs.changes == 'true' }}
383408
strategy:
384409
matrix:
385410
os: [windows-latest]
@@ -448,3 +473,17 @@ jobs:
448473
env_vars: TEST_SUBSET
449474
name: ${{ matrix.os }} ${{ matrix.floatx }}
450475
fail_ci_if_error: false
476+
477+
all_tests:
478+
if: ${{ always() }}
479+
runs-on: ubuntu-latest
480+
needs: [ changes, ubuntu, windows, macos, external_samplers, float32 ]
481+
steps:
482+
- name: Check build matrix status
483+
if: ${{ needs.changes.outputs.changes == 'true' &&
484+
( needs.ubuntu.result != 'success' ||
485+
needs.windows.result != 'success' ||
486+
needs.macos.result != 'success' ||
487+
needs.external_samplers.result != 'success' ||
488+
needs.float32.result != 'success' ) }}
489+
run: exit 1

0 commit comments

Comments
 (0)