diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml index dec2b81c..47bfed1b 100644 --- a/.github/workflows/_build.yml +++ b/.github/workflows/_build.yml @@ -18,9 +18,6 @@ jobs: defaults: run: shell: bash - env: - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: sccache steps: - uses: actions/checkout@v4 @@ -32,8 +29,6 @@ jobs: with: enable-cache: true - - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: zackees/setup-soldr@v0 env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/_integration-test.yml b/.github/workflows/_integration-test.yml index a325dfb4..92b739b7 100644 --- a/.github/workflows/_integration-test.yml +++ b/.github/workflows/_integration-test.yml @@ -15,8 +15,6 @@ jobs: run: shell: bash env: - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: sccache PYTHONIOENCODING: utf-8 steps: - uses: actions/checkout@v4 @@ -29,8 +27,6 @@ jobs: with: enable-cache: true - - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: zackees/setup-soldr@v0 env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/_lint.yml b/.github/workflows/_lint.yml index 1d069299..3547dc9a 100644 --- a/.github/workflows/_lint.yml +++ b/.github/workflows/_lint.yml @@ -14,9 +14,6 @@ jobs: defaults: run: shell: bash - env: - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: sccache steps: - uses: actions/checkout@v4 @@ -28,8 +25,6 @@ jobs: with: enable-cache: true - - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: zackees/setup-soldr@v0 env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/_unit-test.yml b/.github/workflows/_unit-test.yml index 3259b7fa..9ce3aac3 100644 --- a/.github/workflows/_unit-test.yml +++ b/.github/workflows/_unit-test.yml @@ -15,8 +15,6 @@ jobs: run: shell: bash env: - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: sccache PYTHONIOENCODING: utf-8 steps: - uses: actions/checkout@v4 @@ -29,8 +27,6 @@ jobs: with: enable-cache: true - - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: zackees/setup-soldr@v0 env: GITHUB_TOKEN: ${{ github.token }} diff --git a/ci/env.py b/ci/env.py index dfa0d105..6ec69d79 100644 --- a/ci/env.py +++ b/ci/env.py @@ -165,13 +165,21 @@ def activate() -> None: ) -def _apply_sccache(env: dict[str, str]) -> dict[str, str]: - """Set RUSTC_WRAPPER=sccache when sccache is available.""" +def _apply_rustc_wrapper(env: dict[str, str]) -> dict[str, str]: + """Set RUSTC_WRAPPER to zccache when available, falling back to sccache. + + The project uses zccache (via soldr) for compile caching. Prefer it; fall + back to sccache for environments where only that is installed. Bare cargo + invocations that consume this env still benefit from the cache even though + most callers in this repo now route through ``soldr cargo`` directly. + """ if env.get("RUSTC_WRAPPER"): return env - sccache = shutil.which("sccache", path=env.get("PATH")) - if sccache: - env["RUSTC_WRAPPER"] = sccache + for tool in ("zccache", "sccache"): + found = shutil.which(tool, path=env.get("PATH")) + if found: + env["RUSTC_WRAPPER"] = found + return env return env @@ -185,7 +193,7 @@ def clean_env() -> dict[str, str]: env.pop("VIRTUAL_ENV", None) env.setdefault("PYTHONUTF8", "1") env.setdefault("RUSTUP_TOOLCHAIN", toolchain_name()) - env = _apply_sccache(env) + env = _apply_rustc_wrapper(env) return env