bug: don't block CI when the nightly build fails (#9238)

* don't block CI when the nightly build fails

* make suggested chagnes
This commit is contained in:
Eric Pinzur 2025-07-29 21:42:02 +02:00 committed by GitHub
commit a88a6fb743
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,11 +117,10 @@ jobs:
rm -f response.json
set-ci-condition:
needs: check-nightly-status
name: Should Run CI
runs-on: ubuntu-latest
outputs:
should-run-ci: ${{ (needs.check-nightly-status.outputs.should-proceed == 'true' || github.event_name == 'workflow_dispatch') && ((contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event_name == 'merge_group')) }}
should-run-ci: ${{ (contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event_name == 'merge_group') }}
should-run-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'fast-track') || github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' }}
steps:
# Do anything just to make the job run
@ -129,7 +128,6 @@ jobs:
- run: echo "Labels -> ${{ join(github.event.pull_request.labels.*.name, ',') }}"
- run: echo "IsDraft -> ${{ github.event.pull_request.draft }}"
- run: echo "Event name -> ${{ github.event_name }}"
- run: echo "Nightly build status -> ${{ needs.check-nightly-status.outputs.should-proceed }}"
- run: echo "Should run tests -> ${{ !contains(github.event.pull_request.labels.*.name, 'fast-track') || github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' }}"
path-filter:
@ -248,7 +246,8 @@ jobs:
test-docs-build,
test-templates,
set-ci-condition,
path-filter
path-filter,
check-nightly-status
]
if: always()
@ -256,13 +255,87 @@ jobs:
env:
JOBS_JSON: ${{ toJSON(needs) }}
RESULTS_JSON: ${{ toJSON(needs.*.result) }}
EXIT_CODE: ${{ ((!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && needs.set-ci-condition.outputs.should-run-ci == 'true') || (needs.set-ci-condition.outputs.should-run-tests == 'false' && needs.set-ci-condition.outputs.should-run-ci == 'true')) && '0' || '1' }}
EXIT_CODE: ${{ (contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled') ||
(needs.check-nightly-status.outputs.should-proceed != 'true' && github.event_name != 'workflow_dispatch'))
&& '1' || '0' }}
steps:
- name: "CI Success"
run: |
echo $JOBS_JSON
echo $RESULTS_JSON
echo "=== CI Status Summary ==="
echo "Should run tests: ${{ needs.set-ci-condition.outputs.should-run-tests }}"
echo "Should run CI: ${{ needs.set-ci-condition.outputs.should-run-ci }}"
echo "Exiting with $EXIT_CODE"
echo "Nightly build status: ${{ needs.check-nightly-status.outputs.should-proceed }}"
echo "Event type: ${{ github.event_name }}"
echo ""
# Check for job failures
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "❌ CI FAILED: One or more jobs failed"
echo ""
echo "Failed jobs:"
# Dynamically list failed jobs with helpful descriptions
echo "$JOBS_JSON" | jq -r '
to_entries[]
| select(.value.result=="failure")
| .key as $job
| if $job == "test-backend" then
" - Backend Tests: Check Python code, tests, and dependencies"
elif $job == "test-frontend-unit" then
" - Frontend Unit Tests: Check React components and unit test logic"
elif $job == "test-frontend" then
" - Frontend E2E Tests: Check integration tests and UI functionality"
elif $job == "lint-backend" then
" - Backend Linting: Run '\''make format_backend'\'' then '\''make lint'\'' to fix code style issues"
elif $job == "test-docs-build" then
" - Documentation Build: Check documentation syntax and build process"
elif $job == "test-templates" then
" - Template Tests: Check starter project templates"
elif $job == "path-filter" then
" - Path Filter: File path filtering failed"
elif $job == "set-ci-condition" then
" - CI Condition Check: CI condition evaluation failed"
elif $job == "check-nightly-status" then
" - Nightly Status Check: PyPI package status check failed"
else
" - \($job): See job log for details"
end
'
echo ""
echo "🔧 Next steps:"
echo " 1. Review the failed job logs above"
echo " 2. Fix the identified issues in your code"
echo " 3. Push your changes to re-run the tests"
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "⚠️ CI CANCELLED: One or more jobs were cancelled"
echo ""
echo "🔧 Next steps:"
echo " 1. Check if the cancellation was intentional"
echo " 2. Re-run the workflow if needed"
elif [[ "${{ needs.check-nightly-status.outputs.should-proceed }}" != "true" && "${{ github.event_name }}" != "workflow_dispatch" ]]; then
echo "🚫 CI BLOCKED: Nightly build is broken"
echo ""
echo "The nightly PyPI package was not updated today, indicating the nightly build failed."
echo ""
echo "🔧 Next steps:"
echo " 1. Work with the team to investigate and fix the nightly build"
echo " 2. Check the nightly build logs for errors"
echo " 3. Once the nightly build is fixed and publishes successfully, re-run this workflow"
echo " 4. Alternatively, use 'workflow_dispatch' to manually override this check if needed"
else
echo "✅ CI SUCCESS: All checks passed!"
echo ""
echo "🎉 Your changes are ready:"
echo " - All tests passed"
echo " - Code quality checks passed"
echo " - Nightly build is healthy"
fi
echo ""
echo "Exit code: $EXIT_CODE"
exit $EXIT_CODE