Skip to content

Commit 3ed0855

Browse files
committed
feat: Add an all-tests-passed job to aggregate test results and set commit status.
1 parent d920a76 commit 3ed0855

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/build-and-test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,31 @@ jobs:
190190
echo "Error: 'bumped' output is empty"
191191
exit 1
192192
fi
193+
194+
all-tests-passed:
195+
if: always()
196+
needs: [build-dist, test-python, test-npm, test-maven, test-version-file]
197+
runs-on: ubuntu-latest
198+
permissions:
199+
statuses: write
200+
steps:
201+
- name: Determine Status
202+
id: status
203+
run: |
204+
if [[ ${{ contains(needs.*.result, 'failure') }} == 'true' || ${{ contains(needs.*.result, 'cancelled') }} == 'true' ]]; then
205+
echo "status=failure" >> $GITHUB_OUTPUT
206+
else
207+
echo "status=success" >> $GITHUB_OUTPUT
208+
fi
209+
210+
- name: Set Commit Status
211+
uses: myrotvorets/set-commit-status-action@master
212+
with:
213+
token: ${{ secrets.GITHUB_TOKEN }}
214+
status: ${{ steps.status.outputs.status }}
215+
context: "all-tests-passed"
216+
description: "Aggregation of all tests"
217+
218+
- name: Fail if needed
219+
if: steps.status.outputs.status == 'failure'
220+
run: exit 1

0 commit comments

Comments
 (0)