Repository navigation
ci: sccache read-only on pull requests, stable Linux CPU pin #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Pull requests read the Actions cache. Main pushes and schedules write. CARGO_INCREMENTAL=0 was already set. The Linux CPU pin is a cargo config target table beside the Windows stack flags. The shared setup does not set RUSTFLAGS, because Cargo 1.89 replaces every rustflags entry when that variable is set.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,19 @@ runs: | |
| echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" | ||
| echo "SCCACHE_CACHE_SIZE=10G" >> "$GITHUB_ENV" | ||
| echo "SCCACHE_IDLE_TIMEOUT=0" >> "$GITHUB_ENV" | ||
| # sccache 0.19 writes through the Actions cache. A pull request that | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment treats sccache 0.19 as what the job runs. The install step above is still In that tag,
|
||
| # also writes hits the service rate limit (cache write errors) and | ||
| # evicts the shared cache. Main pushes and schedules populate it. | ||
| # CARGO_INCREMENTAL=0 is already required; sccache still refuses bins, | ||
| # cdylibs, and proc-macros. | ||
| if [ "${{ github.ref }}" = "refs/heads/main" ] && [ "${{ github.event_name }}" != "pull_request" ]; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actions expands if [ "$GITHUB_REF" = "refs/heads/main" ] && [ "$GITHUB_EVENT_NAME" != "pull_request" ]; thenThe write arm is also wider than the comment above it. Every event other than |
||
| echo "SCCACHE_GHA_RW_MODE=READ_WRITE" >> "$GITHUB_ENV" | ||
| else | ||
| echo "SCCACHE_GHA_RW_MODE=READ_ONLY" >> "$GITHUB_ENV" | ||
| fi | ||
| # Do not set RUSTFLAGS here. Cargo 1.89 replaces every rustflags | ||
| # entry in .cargo/config.toml when that variable is set. The Linux | ||
| # CPU pin lives in that file next to the Windows stack flags. | ||
|
|
||
| - name: Cache cargo registry (one key per OS, save on main only) | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,6 +193,27 @@ def test_aravath_supply_chain_uses_prebuilt_tools(self) -> None: | |
| self.assertIn("9bd3e599314f50810c9d98b8b68a617ff9d3cc20873968d90b29d121f6b226ff", script) | ||
| self.assertIn('"$tool" cyclonedx --version', script) | ||
|
|
||
| def test_sccache_pull_requests_are_read_only(self) -> None: | ||
| action = (ROOT / ".github" / "actions" / "rust-ci-setup" / "action.yml").read_text(encoding="utf-8") | ||
| self.assertIn("CARGO_INCREMENTAL=0", action) | ||
| self.assertIn("SCCACHE_GHA_RW_MODE=READ_ONLY", action) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These Lock one substring that contains the |
||
| self.assertIn("SCCACHE_GHA_RW_MODE=READ_WRITE", action) | ||
| self.assertIn("refs/heads/main", action) | ||
| # RUSTFLAGS replaces every rustflags entry. The pin is in cargo config. | ||
| self.assertNotIn("RUSTFLAGS=", action) | ||
| config = (ROOT / ".cargo" / "config.toml").read_text(encoding="utf-8") | ||
| self.assertIn("[target.x86_64-unknown-linux-gnu]", config) | ||
| self.assertIn('"-C", "target-cpu=x86-64"', config) | ||
| self.assertIn("[target.x86_64-pc-windows-msvc]", config) | ||
| self.assertIn("link-args=/STACK:16777216", config) | ||
| self.assertIn("[target.x86_64-pc-windows-gnu]", config) | ||
| self.assertIn("link-args=-Wl,--stack,16777216", config) | ||
| replay = (WORKFLOWS / "determinism-replay.yml").read_text(encoding="utf-8") | ||
| self.assertIn('echo "RUSTFLAGS=-C target-cpu=x86-64" >> "$GITHUB_ENV"', replay) | ||
| self.assertIn("target-cpu=native is forbidden", replay) | ||
| aravath = (WORKFLOWS / "aravath-determinism.yml").read_text(encoding="utf-8") | ||
| self.assertIn("-C target-feature=-fma", aravath) | ||
|
|
||
| def test_allocation_measurement_is_a_real_gate_off_prs(self) -> None: | ||
| text = (WORKFLOWS / "allocation-measurement.yml").read_text(encoding="utf-8") | ||
| self.assertIn("schedule:", text) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment treats sccache 0.19 as the implementation. The install step calls
mozilla-actions/sccache-action@v0.0.9with noversioninput, and that action installs the latest release when the input is empty. Latest on 2026-10-28 isv0.19.0(published 2026-10-24), soSCCACHE_GHA_RW_MODEworks today. In that tag, an unrecognized mode warns andconfig_from_envusesunwrap_or(ReadWrite). A later release that renames or drops the variable turns pull requests back into writers, andtest_sccache_pull_requests_are_read_onlystill passes because it only searches this file for the string. Passversion: "0.19.0".