返回 CodeWhale
release-parity.yml
根目录 / .github / workflows / release-parity.yml
1 name: Release parity
2
3 # The one parity gate. release-candidate.yml and release.yml both call this,
4 # so the SHA an RC validates has passed exactly the gate that publish runs.
5 # Before this was shared, the RC skipped parity: RC 35707500620 was green on
6 # 3e8bf29946, Release 35728585975 then failed parity on that SHA, and v0.10.0
7 # was re-pointed to 1be1a703b, which docs/RELEASE_RUNBOOK.md forbids.
8 #
9 # Checks out the caller's GITHUB_SHA. Callers must verify that SHA first.
10 on:
11 workflow_call:
12
13 permissions:
14 contents: read
15
16 env:
17 CARGO_TERM_COLOR: always
18 CARGO_INCREMENTAL: 0
19 RUSTFLAGS: -Dwarnings
20
21 jobs:
22 parity:
23 name: Workspace parity
24 # Cold check, Clippy, executable and test builds exceeded the old 45m
25 # limit before the suite started. Retain the full CI test-job budget.
26 timeout-minutes: 210
27 runs-on: ubuntu-24.04
28 steps:
29 # Every caller's resolve job already proved GITHUB_SHA equals the
30 # candidate or tag commit. Do not interpolate a SHA into checkout or
31 # cache keys —
32 # CodeQL treats a *sha* ref as an untrusted checkout on workflow_dispatch
33 # (default-branch cache write).
34 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
35 - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-07-18
36 with:
37 toolchain: 1.100.0
38 components: clippy, rustfmt
39 - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
40 with:
41 version: "v0.19.0"
42 id: sccache
43 continue-on-error: true
44 - name: Enable sccache
45 if: steps.sccache.outcome == 'success'
46 shell: bash
47 run: |
48 {
49 echo "SCCACHE_GHA_ENABLED=true"
50 echo "RUSTC_WRAPPER=sccache"
51 echo "SCCACHE_IGNORE_SERVER_IO_ERROR=1"
52 echo "SCCACHE_IDLE_TIMEOUT=0"
53 } >> "${GITHUB_ENV}"
54 - name: Install Linux system dependencies
55 run: |
56 for i in 1 2 3 4 5; do
57 sudo apt-get update && break
58 echo "apt-get update failed (attempt $i); retrying in 15s"
59 sleep 15
60 done
61 sudo apt-get install -y libdbus-1-dev pkg-config bubblewrap apparmor-profiles
62 sh scripts/ci/prepare-linux-test-sandbox.sh
63 # Restore after the trusted lockfile is on disk. Key is OS + arch +
64 # explicit stable toolchain + rust-cache's Cargo.lock / rust-toolchain
65 # hash. Never interpolate github.event, github.ref, github.sha, or inputs.
66 - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
67 with:
68 cache-bin: false
69 prefix-key: v1-${{ runner.os }}-${{ runner.arch }}-stable
70 - uses: taiki-e/install-action@b6620ca104fb7b50dafa1109be9622abc1fdd381 # nextest
71 with:
72 tool: cargo-nextest@0.9.151
73 - name: Format check
74 run: cargo fmt --all -- --check
75 - name: Compile check
76 run: cargo check --workspace --all-targets --locked
77 - name: OHOS dependency graph
78 run: ./scripts/release/check-ohos-deps.sh
79 - name: Clippy
80 # Same lint set as ci.yml's "Run clippy": collapsible_if and
81 # assertions_on_constants were removed there on purpose, so allowing
82 # them here made the release gate weaker than the merge gate.
83 run: |
84 cargo clippy --workspace --all-targets --all-features --locked -- \
85 -D warnings \
86 -A clippy::uninlined_format_args \
87 -A clippy::too_many_arguments \
88 -A clippy::unnecessary_map_or
89 - name: Build headroom
90 # Same fixed ephemeral-runner provisioning as CI Safety, Lint, and Test.
91 # Resource headroom is preventive; a shutdown alone does not prove OOM.
92 shell: bash
93 run: bash scripts/ci/prepare-ubuntu-build-headroom.sh
94 - name: Build canonical executable for acceptance tests
95 run: cargo build -p codewhale-cli --bin codewhale --all-features --locked
96 - name: Workspace tests
97 # Same test binaries as `cargo test`, run by cargo-nextest: one process
98 # per test. This gate used libtest, where every test shares one process,
99 # so a test that mutates process-global state leaks into its neighbours.
100 # It failed on five such tests — deterministically, and on a different
101 # set on different machines — while CI's nextest lanes were green on the
102 # same source, and every one of them passes in isolation. Match the lane
103 # that gates every merge; doctests are the next step, because nextest
104 # does not run them.
105 # The runner has been shut down during this step's build on several
106 # candidates (exit 143, no test result). The same headroom trace as
107 # ci-test-suite.yml's shard step records whether memory or disk ran out, starting
108 # with what the earlier check and clippy steps left behind.
109 shell: bash
110 run: |
111 echo "[headroom] before tests: $(free -m | awk '/^Mem:/{print "mem used " $3 "/" $2 " MiB"} /^Swap:/{print "swap used " $3 "/" $2 " MiB"}' | paste -sd ' ') disk free $(df -h / | awk 'NR==2{print $4}') target $(du -sh target 2>/dev/null | cut -f1)"
112 ( while sleep 30; do
113 echo "[headroom] $(free -m | awk '/^Mem:/{print "mem used " $3 "/" $2 " MiB"} /^Swap:/{print "swap used " $3 "/" $2 " MiB"}' | paste -sd ' ') disk free $(df -h / | awk 'NR==2{print $4}')"
114 done ) &
115 monitor=$!
116 status=0
117 sh scripts/with-hermetic-test-home.sh cargo nextest run --workspace --all-features --locked --profile ci || status=$?
118 kill "$monitor" 2>/dev/null || true
119 exit "$status"
120 env:
121 CARGO_BUILD_JOBS: '1'
122 # Match the CI test lane: test threads get the same stack the product
123 # gives itself (main.rs CODEWHALE_MAIN_STACK_BYTES). See the note in
124 # ci-test-suite.yml's "Run tests" step. Without it this gate runs the deep
125 # engine/runtime futures on a stack that never ships.
126 RUST_MIN_STACK: '16777216'
127 - name: Workspace doctests
128 run: sh scripts/with-hermetic-test-home.sh cargo test --workspace --all-features --locked --doc
129 env:
130 RUST_MIN_STACK: '16777216'
131 - name: Protocol schema parity
132 run: sh scripts/with-hermetic-test-home.sh cargo test -p codewhale-protocol --test parity_protocol --locked
133 - name: State persistence parity
134 run: sh scripts/with-hermetic-test-home.sh cargo test -p codewhale-state --test parity_state --locked
135 - name: Lockfile drift guard
136 run: git diff --exit-code -- Cargo.lock
137
137 lines YAML