Skip to content

Commit 33c05d1

Browse files
authored
Merge pull request #4401 from BowTiedDevOps/feat/check-jobs-success-with-composite
Check Multiple Tests' Success at Once
2 parents c8aa832 + f4593c1 commit 33c05d1

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed

.github/workflows/atlas-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,17 @@ jobs:
5454
uses: stacks-network/actions/codecov@main
5555
with:
5656
test-name: ${{ matrix.test-name }}
57+
58+
check-tests:
59+
name: Check Tests
60+
runs-on: ubuntu-latest
61+
if: always()
62+
needs:
63+
- atlas-tests
64+
steps:
65+
- name: Check Tests Status
66+
id: check_tests_status
67+
uses: stacks-network/actions/check-jobs-status@main
68+
with:
69+
jobs: ${{ toJson(needs) }}
70+
summary_print: "true"

.github/workflows/bitcoin-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,17 @@ jobs:
9494
uses: stacks-network/actions/codecov@main
9595
with:
9696
test-name: ${{ matrix.test-name }}
97+
98+
check-tests:
99+
name: Check Tests
100+
runs-on: ubuntu-latest
101+
if: always()
102+
needs:
103+
- integration-tests
104+
steps:
105+
- name: Check Tests Status
106+
id: check_tests_status
107+
uses: stacks-network/actions/check-jobs-status@main
108+
with:
109+
jobs: ${{ toJson(needs) }}
110+
summary_print: "true"

.github/workflows/epoch-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,17 @@ jobs:
7878
uses: stacks-network/actions/codecov@main
7979
with:
8080
test-name: ${{ matrix.test-name }}
81+
82+
check-tests:
83+
name: Check Tests
84+
runs-on: ubuntu-latest
85+
if: always()
86+
needs:
87+
- epoch-tests
88+
steps:
89+
- name: Check Tests Status
90+
id: check_tests_status
91+
uses: stacks-network/actions/check-jobs-status@main
92+
with:
93+
jobs: ${{ toJson(needs) }}
94+
summary_print: "true"

.github/workflows/slow-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ jobs:
5656
uses: stacks-network/actions/codecov@main
5757
with:
5858
test-name: ${{ matrix.test-name }}
59+
60+
check-tests:
61+
name: Check Tests
62+
runs-on: ubuntu-latest
63+
if: always()
64+
needs:
65+
- slow-tests
66+
steps:
67+
- name: Check Tests Status
68+
id: check_tests_status
69+
uses: stacks-network/actions/check-jobs-status@main
70+
with:
71+
jobs: ${{ toJson(needs) }}
72+
summary_print: "true"

.github/workflows/stacks-core-tests.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,19 @@ jobs:
180180
with:
181181
args: test --manifest-path=./contrib/core-contract-tests/Clarinet.toml contrib/core-contract-tests/tests/bns/name_register_test.ts
182182

183+
check-tests:
184+
name: Check Tests
185+
runs-on: ubuntu-latest
186+
if: always()
187+
needs:
188+
- full-genesis
189+
- unit-tests
190+
- open-api-validation
191+
- core-contracts-clarinet-test
192+
steps:
193+
- name: Check Tests Status
194+
id: check_tests_status
195+
uses: stacks-network/actions/check-jobs-status@main
196+
with:
197+
jobs: ${{ toJson(needs) }}
198+
summary_print: "true"

docs/ci-release.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,35 @@ ex:
135135
- `Stacks Blockchain Tests`:
136136
- `full-genesis`: Tests related to full genesis
137137

138+
### Checking the result of multiple tests at once
139+
140+
You can use the [check-jobs-status](https://github.com/stacks-network/actions/tree/main/check-jobs-status) composite action in order to check that multiple tests are successful in 1 job.
141+
If any of the tests given to the action (JSON string of `needs` field) fails, the step that calls the action will also fail.
142+
143+
If you have to mark more than 1 job from the same workflow required in a ruleset, you can use this action in a separate job and only add that job as required.
144+
145+
In the following example, `unit-tests` is a matrix job with 8 partitions (i.e. 8 jobs are running), while the others are normal jobs.
146+
If any of the 11 jobs are failing, the `check-tests` job will also fail.
147+
148+
```yaml
149+
check-tests:
150+
name: Check Tests
151+
runs-on: ubuntu-latest
152+
if: always()
153+
needs:
154+
- full-genesis
155+
- unit-tests
156+
- open-api-validation
157+
- core-contracts-clarinet-test
158+
steps:
159+
- name: Check Tests Status
160+
id: check_tests_status
161+
uses: stacks-network/actions/check-jobs-status@main
162+
with:
163+
jobs: ${{ toJson(needs) }}
164+
summary_print: "true"
165+
```
166+
138167
## Triggering a workflow
139168

140169
### PR a branch to develop

0 commit comments

Comments
 (0)