fix: trying to simplify rust-ci.yml (#2327)
It turns out that https://github.com/openai/codex/pull/2324 did not quite work as intended. Chat's new idea is to have this catch-all "CI results" job and update our branch protection rules to require this instead.
This commit is contained in:
25
.github/workflows/rust-ci.yml
vendored
25
.github/workflows/rust-ci.yml
vendored
@@ -69,6 +69,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
needs: changed
|
needs: changed
|
||||||
|
# Keep job-level if to avoid spinning up runners when not needed
|
||||||
if: ${{ needs.changed.outputs.codex == 'true' || needs.changed.outputs.workflows == 'true' || github.event_name == 'push' }}
|
if: ${{ needs.changed.outputs.codex == 'true' || needs.changed.outputs.workflows == 'true' || github.event_name == 'push' }}
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
@@ -166,3 +167,27 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "One or more checks failed (clippy, build, or test). See logs for details."
|
echo "One or more checks failed (clippy, build, or test). See logs for details."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
# --- Gatherer job that you mark as the ONLY required status -----------------
|
||||||
|
results:
|
||||||
|
name: CI results (required)
|
||||||
|
needs: [changed, general, lint_build_test]
|
||||||
|
if: always()
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Summarize
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "general: ${{ needs.general.result }}"
|
||||||
|
echo "matrix : ${{ needs.lint_build_test.result }}"
|
||||||
|
|
||||||
|
# If nothing relevant changed (PR touching only root README, etc.),
|
||||||
|
# declare success regardless of other jobs.
|
||||||
|
if [[ '${{ needs.changed.outputs.codex }}' != 'true' && '${{ needs.changed.outputs.workflows }}' != 'true' && '${{ github.event_name }}' != 'push' ]]; then
|
||||||
|
echo 'No relevant changes -> CI not required.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Otherwise require the jobs to have succeeded
|
||||||
|
[[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; }
|
||||||
|
[[ '${{ needs.lint_build_test.result }}' == 'success' ]] || { echo 'matrix failed'; exit 1; }
|
||||||
|
|||||||
Reference in New Issue
Block a user