Skip to content

Commit 69b6819

Browse files
CSResselclaude
andauthored
ci: Remove sccache from GitHub workflows (#75)
Remove all sccache-related configuration and replace with simple cargo home directory caching. This simplifies the CI workflow by caching only the cargo registry, git dependencies, and binaries, avoiding the complexity and size issues of target directory caching. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0cc23a2 commit 69b6819

1 file changed

Lines changed: 10 additions & 49 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414
working-directory: codex-rs
1515
env:
1616
CARGO_INCREMENTAL: "0"
17-
SCCACHE_CACHE_SIZE: 10G
1817

1918
strategy:
2019
fail-fast: false
@@ -44,8 +43,7 @@ jobs:
4443
echo "hash=$(sha256sum Cargo.lock | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
4544
echo "toolchain_hash=$(sha256sum rust-toolchain.toml | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
4645
47-
# Explicit cache restore: split cargo home vs target, so we can
48-
# avoid caching the large target dir on the gnu-dev job.
46+
# Cache cargo home directory (registry, git deps, etc.)
4947
- name: Restore cargo home cache
5048
id: cache_cargo_home_restore
5149
uses: actions/cache/restore@v4
@@ -59,41 +57,6 @@ jobs:
5957
restore-keys: |
6058
cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-
6159
62-
# Install and restore sccache cache
63-
- name: Install sccache
64-
if: ${{ env.USE_SCCACHE == 'true' }}
65-
uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2
66-
with:
67-
tool: sccache
68-
version: 0.7.5
69-
70-
- name: Configure sccache backend
71-
shell: bash
72-
run: |
73-
set -euo pipefail
74-
if [[ -n "${ACTIONS_CACHE_URL:-}" && -n "${ACTIONS_RUNTIME_TOKEN:-}" ]]; then
75-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
76-
echo "Using sccache GitHub backend"
77-
else
78-
echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
79-
echo "SCCACHE_DIR=${{ github.workspace }}/.sccache" >> "$GITHUB_ENV"
80-
echo "Using sccache local disk fallback"
81-
fi
82-
83-
- name: Enable sccache wrapper
84-
shell: bash
85-
run: echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
86-
87-
- name: Restore sccache cache (fallback)
88-
if: ${{ env.SCCACHE_GHA_ENABLED != 'true' }}
89-
uses: actions/cache/restore@v4
90-
with:
91-
path: ${{ github.workspace }}/.sccache/
92-
key: sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }}
93-
restore-keys: |
94-
sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}-
95-
sccache-${{ matrix.runner }}-${{ matrix.target }}-
96-
9760
# CI checks
9861
- name: cargo check
9962
run: cargo check --target ${{ matrix.target }} --all-features
@@ -108,16 +71,14 @@ jobs:
10871
continue-on-error: true # TODO: Fix pre-existing test failures in codex-app-server
10972
run: cargo test --target ${{ matrix.target }} --all-features
11073

111-
# Save sccache
112-
- name: Save sccache cache (fallback)
113-
if: always() && !cancelled() && env.SCCACHE_GHA_ENABLED != 'true'
114-
continue-on-error: true
74+
# Save cargo home cache
75+
- name: Save cargo home cache
76+
if: always() && !cancelled()
11577
uses: actions/cache/save@v4
11678
with:
117-
path: ${{ github.workspace }}/.sccache/
118-
key: sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }}
119-
120-
- name: sccache stats
121-
if: always()
122-
continue-on-error: true
123-
run: sccache --show-stats || true
79+
path: |
80+
~/.cargo/bin/
81+
~/.cargo/registry/index/
82+
~/.cargo/registry/cache/
83+
~/.cargo/git/db/
84+
key: cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}

0 commit comments

Comments
 (0)