Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add step to fail workflow if matrix branch fails #2044

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,24 @@ jobs:
run: |
$E2E_BINARY=Get-ChildItem -Path .\${{ matrix.testing_target.binary_under_test }}\deps -File | Where-Object { $_.Name -like 'e2e-*.exe' } | ForEach-Object { $_.FullName }
Write-Output "Found '$E2E_BINARY'"
& $E2E_BINARY --ignored --nocapture
& $E2E_BINARY --ignored --nocapture
# It appears as though GitHub Actions mechanisms for handling errors within matrix job runs are... less than
# intuitive. There's an answer here (https://github.com/orgs/community/discussions/26822) that describes the
# fact that if any of the jobs in the matrix succeeds then the job is marked successful as well. So we
# have to intervene manually to ensure this job actually fails if any of the branches of the matrix fails.
#
# It might be the case we can simplify this as future GitHub Actions changes may render this obsolete, but for
# now this appears to be the only solution.
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Final Results
needs: [ smoke_tests ]
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
Loading