Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ jobs:
defaults:
run:
shell: bash
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
steps:
- uses: actions/checkout@v4

Expand All @@ -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 }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/_integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
run:
shell: bash
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
PYTHONIOENCODING: utf-8
steps:
- uses: actions/checkout@v4
Expand All @@ -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 }}
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
defaults:
run:
shell: bash
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
steps:
- uses: actions/checkout@v4

Expand All @@ -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 }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/_unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
run:
shell: bash
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
PYTHONIOENCODING: utf-8
steps:
- uses: actions/checkout@v4
Expand All @@ -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 }}
Expand Down
20 changes: 14 additions & 6 deletions ci/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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


Expand Down
Loading