Fail the Runtime tests check if the previous jobs were cancelled or failed (#3825)

* Fail the Runtime tests check if the previous jobs were cancelled or failed

* Check only for failures

* Add test exit

* Test cancel

* fix conditions

* fix condition again

* Try another way

* Now test success
This commit is contained in:
mamoodi 2024-09-11 16:40:00 -04:00 committed by GitHub
parent 93ecd82e61
commit 41b8f3e4a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -229,11 +229,26 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Checks that all runtime tests have passed
all_runtime_tests_passed:
# The two following jobs (named identically) are to check whether all the runtime tests have passed as the
# "All Runtime Tests Passed" is a required job for PRs to merge
# Due to this bug: https://github.com/actions/runner/issues/2566, we want to create a job that runs when the
# prerequisites have been cancelled or failed so merging is disallowed, otherwise Github considers "skipped" as "success"
runtime_tests_check_success:
name: All Runtime Tests Passed
if: ${{ !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
runs-on: ubuntu-latest
needs: [test_runtime, runtime_integration_tests_on_linux]
steps:
- name: All tests passed
run: echo "All runtime tests have passed successfully!"
runtime_tests_check_fail:
name: All Runtime Tests Passed
if: ${{ cancelled() || contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
runs-on: ubuntu-latest
needs: [test_runtime, runtime_integration_tests_on_linux]
steps:
- name: Some tests failed
run: |
echo "Some runtime tests failed or were cancelled"
exit 1