mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] group blocking and postmerge CI workflows (#30146)
## Why It's hard to change the set of required jobs when they're managed in the GitHub UI, and when each workflow is responsible for choosing it's own scheduling it's easy to end up with skew between what we enforce on PRs vs. on main. ## What - add a `blocking-ci` caller workflow, triggered by pull requests and pushes to `main`, for Bazel, blob size, cargo-deny, Codespell, `repo-checks`, rust CI, and SDK CI - add an `always()` terminal job named `CI required` that fails unless every called workflow succeeds - add a `postmerge-ci` caller workflow for `rust-ci-full` and `v8-canary`, with a terminal `Postmerge CI results` job - centralize V8 relevance detection in `v8_canary_changes.py`; unrelated PR and postmerge runs execute metadata only and skip the expensive build matrices - leave `v8-canary` outside the blocking gate and leave the external `cla` check independent ## Rollout A repository admin must replace the existing required GitHub Actions contexts with `CI required` in the main-branch ruleset. Retain `cla` as a separate required check. Until that change is coordinated, this PR cannot satisfy the old standalone check names. In-flight PRs will need to be rebased after this lands.
This commit is contained in:
committed by
GitHub
Unverified
parent
6509f3148a
commit
1168254bd9
@@ -4,10 +4,7 @@ name: Bazel
|
||||
# https://github.com/cerisier/toolchains_llvm_bootstrapped/blob/main/.github/workflows/ci.yaml
|
||||
|
||||
on:
|
||||
pull_request: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: blob-size-policy
|
||||
|
||||
on:
|
||||
pull_request: {}
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
@@ -14,13 +14,24 @@ jobs:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Determine PR comparison range
|
||||
- name: Determine comparison range
|
||||
id: range
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "base=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"
|
||||
echo "head=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# PRs inspect the proposed diff; main pushes inspect only the commit
|
||||
# range that just landed. Both paths feed the same blob-size checker.
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
base='${{ github.event.pull_request.base.sha }}'
|
||||
head='${{ github.event.pull_request.head.sha }}'
|
||||
else
|
||||
base='${{ github.event.before }}'
|
||||
head='${{ github.sha }}'
|
||||
fi
|
||||
|
||||
echo "base=$base" >> "$GITHUB_OUTPUT"
|
||||
echo "head=$head" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Check changed blob sizes
|
||||
env:
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
name: blocking-ci
|
||||
|
||||
# This is the single entrypoint for checks that block a PR merge. It also runs
|
||||
# after pushes to main so the same check family stays grouped in the Actions UI.
|
||||
on:
|
||||
pull_request: {}
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
# Keep reusable workflow calls alphabetized. The `required` job below is the
|
||||
# version-controlled list that the main-branch ruleset should require.
|
||||
bazel:
|
||||
name: Bazel
|
||||
uses: ./.github/workflows/bazel.yml
|
||||
secrets: inherit
|
||||
|
||||
blob-size-policy:
|
||||
name: Blob size policy
|
||||
uses: ./.github/workflows/blob-size-policy.yml
|
||||
secrets: inherit
|
||||
|
||||
cargo-deny:
|
||||
name: cargo-deny
|
||||
uses: ./.github/workflows/cargo-deny.yml
|
||||
secrets: inherit
|
||||
|
||||
codespell:
|
||||
name: Codespell
|
||||
uses: ./.github/workflows/codespell.yml
|
||||
secrets: inherit
|
||||
|
||||
repo-checks:
|
||||
name: repo-checks
|
||||
uses: ./.github/workflows/repo-checks.yml
|
||||
secrets: inherit
|
||||
|
||||
rust-ci:
|
||||
name: rust-ci
|
||||
uses: ./.github/workflows/rust-ci.yml
|
||||
secrets: inherit
|
||||
|
||||
sdk:
|
||||
name: sdk
|
||||
uses: ./.github/workflows/sdk.yml
|
||||
secrets: inherit
|
||||
|
||||
required:
|
||||
name: CI required
|
||||
# Without `always()`, GitHub skips this job after a failed dependency and a
|
||||
# required check can appear successful instead of reporting the failure.
|
||||
if: ${{ always() }}
|
||||
needs:
|
||||
- bazel
|
||||
- blob-size-policy
|
||||
- cargo-deny
|
||||
- codespell
|
||||
- repo-checks
|
||||
- rust-ci
|
||||
- sdk
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
# Keep the helper on the same revision as the caller and child workflows.
|
||||
# CI workflow uploads are restricted, so this repository does not need a
|
||||
# separate trusted-base checkout for the terminal policy step. Using the
|
||||
# PR head also lets the introducing PR exercise a newly added helper.
|
||||
#
|
||||
# During the initial rollout, PR branches created before
|
||||
# check_ci_results.py exists must rebase onto main before this gate can
|
||||
# run.
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Require successful dependencies
|
||||
env:
|
||||
NEEDS: ${{ toJSON(needs) }}
|
||||
run: python3 .github/scripts/check_ci_results.py
|
||||
@@ -1,10 +1,7 @@
|
||||
name: cargo-deny
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_call:
|
||||
|
||||
# Cargo's libgit2 transport has been flaky when fetching git dependencies with
|
||||
# nested submodules. Prefer the system git CLI across every Cargo invocation.
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
name: Codespell
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
name: postmerge-ci
|
||||
|
||||
# This is the single entrypoint for main-only CI that is intentionally outside
|
||||
# the merge-blocking suite. It keeps the broader postmerge signal in one run.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
# Keep reusable workflow calls alphabetized. Each child retains its own
|
||||
# workflow_dispatch trigger so maintainers can rerun flaky suites directly.
|
||||
rust-ci-full:
|
||||
name: rust-ci-full
|
||||
uses: ./.github/workflows/rust-ci-full.yml
|
||||
secrets: inherit
|
||||
|
||||
v8-canary:
|
||||
name: v8-canary
|
||||
uses: ./.github/workflows/v8-canary.yml
|
||||
secrets: inherit
|
||||
|
||||
results:
|
||||
name: Postmerge CI results
|
||||
needs:
|
||||
- rust-ci-full
|
||||
- v8-canary
|
||||
if: ${{ always() }}
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
# Postmerge runs use the pushed main commit, so this helper always comes
|
||||
# from the same revision that defined the parent workflow.
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Require successful dependencies
|
||||
env:
|
||||
NEEDS: ${{ toJSON(needs) }}
|
||||
run: python3 .github/scripts/check_ci_results.py
|
||||
@@ -1,8 +1,7 @@
|
||||
name: ci
|
||||
name: repo-checks
|
||||
|
||||
on:
|
||||
pull_request: {}
|
||||
push: { branches: [main] }
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
@@ -1,8 +1,10 @@
|
||||
name: rust-ci-full
|
||||
on:
|
||||
workflow_call:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
# Main pushes enter through postmerge-ci. Keep this opt-in branch trigger
|
||||
# for developers who want the full suite before merging.
|
||||
- "**full-ci**"
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: rust-ci
|
||||
on:
|
||||
pull_request: {}
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
|
||||
# Cargo's libgit2 transport has been flaky when fetching git dependencies with
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
name: sdk
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request: {}
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
python-sdk:
|
||||
|
||||
@@ -1,44 +1,12 @@
|
||||
name: v8-canary
|
||||
|
||||
# Do not use trigger-level path filters here. This workflow is also called by
|
||||
# postmerge-ci, and GitHub cannot share a path filter between pull_request and
|
||||
# workflow_call. v8_canary_changes.py is the single source of truth instead;
|
||||
# unrelated events run only the cheap metadata job below.
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- ".bazelrc"
|
||||
- ".github/actions/setup-bazel-ci/**"
|
||||
- ".github/scripts/run_bazel_with_buildbuddy.py"
|
||||
- ".github/scripts/rusty_v8_bazel.py"
|
||||
- ".github/scripts/rusty_v8_module_bazel.py"
|
||||
- ".github/scripts/v8_canary_changes.py"
|
||||
- ".github/workflows/rusty-v8-release.yml"
|
||||
- ".github/workflows/v8-canary.yml"
|
||||
- "MODULE.bazel"
|
||||
- "MODULE.bazel.lock"
|
||||
- "codex-rs/Cargo.toml"
|
||||
- "patches/BUILD.bazel"
|
||||
- "patches/llvm_*.patch"
|
||||
- "patches/rules_cc_*.patch"
|
||||
- "patches/v8_*.patch"
|
||||
- "third_party/v8/**"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".bazelrc"
|
||||
- ".github/actions/setup-bazel-ci/**"
|
||||
- ".github/scripts/run_bazel_with_buildbuddy.py"
|
||||
- ".github/scripts/rusty_v8_bazel.py"
|
||||
- ".github/scripts/rusty_v8_module_bazel.py"
|
||||
- ".github/scripts/v8_canary_changes.py"
|
||||
- ".github/workflows/rusty-v8-release.yml"
|
||||
- ".github/workflows/v8-canary.yml"
|
||||
- "MODULE.bazel"
|
||||
- "MODULE.bazel.lock"
|
||||
- "codex-rs/Cargo.toml"
|
||||
- "patches/BUILD.bazel"
|
||||
- "patches/llvm_*.patch"
|
||||
- "patches/rules_cc_*.patch"
|
||||
- "patches/v8_*.patch"
|
||||
- "third_party/v8/**"
|
||||
workflow_call:
|
||||
pull_request: {}
|
||||
workflow_dispatch:
|
||||
|
||||
# Cargo's libgit2 transport has been flaky when fetching git dependencies with
|
||||
@@ -54,6 +22,10 @@ jobs:
|
||||
metadata:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
# A stale PR head can contain the old detector, which does not emit this
|
||||
# output. Missing must mean "run" so older branches cannot silently skip
|
||||
# the expensive V8 coverage while reporting success.
|
||||
canary_required: ${{ steps.changes.outputs.canary_required || 'true' }}
|
||||
v8_version: ${{ steps.v8_version.outputs.version }}
|
||||
windows_source_required: ${{ steps.changes.outputs.windows_source_required }}
|
||||
|
||||
@@ -77,7 +49,7 @@ jobs:
|
||||
version="$(python3 .github/scripts/rusty_v8_bazel.py resolved-v8-crate-version)"
|
||||
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Detect whether Windows source artifacts need rebuilding
|
||||
- name: Detect V8 canary changes
|
||||
id: changes
|
||||
env:
|
||||
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
||||
@@ -87,6 +59,8 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# Manual runs have no meaningful before/after range. Force every V8
|
||||
# variant so workflow_dispatch remains a reliable retry path.
|
||||
if [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then
|
||||
output="$(python3 .github/scripts/v8_canary_changes.py --force)"
|
||||
else
|
||||
@@ -104,6 +78,8 @@ jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.variant }} ${{ matrix.target }}
|
||||
needs: metadata
|
||||
# Metadata always runs; only relevant changes pay for the large matrix.
|
||||
if: ${{ needs.metadata.outputs.canary_required == 'true' }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
Reference in New Issue
Block a user