Skip to content

Commit 08cff51

Browse files
echobtfactorydroid
andauthored
ci: replace sccache with Swatinem/rust-cache for improved stability (#227)
Remove mozilla-actions/sccache-action which was causing frequent crashes in CI/CD pipelines. Replace it with Swatinem/rust-cache@v2 which provides: - Better stability and reliability - Similar performance via intelligent incremental caching - Simpler configuration without wrapper setup - No RUSTC_WRAPPER or separate registry caching needed This change affects both CI and Release workflows, replacing all sccache setup steps with the rust-cache action. Co-authored-by: Droid Agent <droid@factory.ai>
1 parent 0d02025 commit 08cff51

File tree

2 files changed

+27
-132
lines changed

2 files changed

+27
-132
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ env:
1515
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
1616
# Incremental compilation off for CI (more reproducible, better caching)
1717
CARGO_INCREMENTAL: 0
18-
# Use sccache for shared compilation cache
19-
SCCACHE_GHA_ENABLED: "true"
20-
RUSTC_WRAPPER: "sccache"
2118

2219
# Ensure only one CI run per branch at a time
2320
concurrency:
@@ -75,28 +72,11 @@ jobs:
7572
with:
7673
components: clippy
7774

78-
- name: Setup sccache
79-
uses: mozilla-actions/sccache-action@v0.0.6
80-
81-
- name: Cache cargo registry & git
82-
uses: actions/cache@v4
83-
with:
84-
path: |
85-
~/.cargo/registry/index/
86-
~/.cargo/registry/cache/
87-
~/.cargo/git/db/
88-
key: cargo-registry-${{ needs.setup-cache.outputs.cache-key }}
89-
restore-keys: |
90-
cargo-registry-
91-
92-
- name: Cache cargo build
93-
uses: actions/cache@v4
75+
- name: Setup Rust cache
76+
uses: Swatinem/rust-cache@v2
9477
with:
95-
path: target/
96-
key: cargo-build-clippy-${{ runner.os }}-${{ needs.setup-cache.outputs.cache-key }}
97-
restore-keys: |
98-
cargo-build-clippy-${{ runner.os }}-
99-
cargo-build-${{ runner.os }}-
78+
prefix-key: "rust-clippy"
79+
shared-key: ${{ needs.setup-cache.outputs.cache-key }}
10080

10181
- name: Run clippy
10282
run: cargo +nightly clippy --workspace --all-targets --all-features --exclude cortex-gui -- -D warnings
@@ -130,28 +110,11 @@ jobs:
130110
- name: Install Rust nightly
131111
uses: dtolnay/rust-toolchain@nightly
132112

133-
- name: Setup sccache
134-
uses: mozilla-actions/sccache-action@v0.0.6
135-
136-
- name: Cache cargo registry & git
137-
uses: actions/cache@v4
138-
with:
139-
path: |
140-
~/.cargo/registry/index/
141-
~/.cargo/registry/cache/
142-
~/.cargo/git/db/
143-
key: cargo-registry-${{ needs.setup-cache.outputs.cache-key }}
144-
restore-keys: |
145-
cargo-registry-
146-
147-
- name: Cache cargo build
148-
uses: actions/cache@v4
113+
- name: Setup Rust cache
114+
uses: Swatinem/rust-cache@v2
149115
with:
150-
path: target/
151-
key: cargo-build-test-${{ matrix.name }}-${{ needs.setup-cache.outputs.cache-key }}
152-
restore-keys: |
153-
cargo-build-test-${{ matrix.name }}-
154-
cargo-build-${{ matrix.name }}-
116+
prefix-key: "rust-test-${{ matrix.name }}"
117+
shared-key: ${{ needs.setup-cache.outputs.cache-key }}
155118

156119
- name: Run tests
157120
run: cargo +nightly test --workspace --all-features --exclude cortex-gui
@@ -187,28 +150,11 @@ jobs:
187150
- name: Install Rust nightly
188151
uses: dtolnay/rust-toolchain@nightly
189152

190-
- name: Setup sccache
191-
uses: mozilla-actions/sccache-action@v0.0.6
192-
193-
- name: Cache cargo registry & git
194-
uses: actions/cache@v4
195-
with:
196-
path: |
197-
~/.cargo/registry/index/
198-
~/.cargo/registry/cache/
199-
~/.cargo/git/db/
200-
key: cargo-registry-${{ needs.setup-cache.outputs.cache-key }}
201-
restore-keys: |
202-
cargo-registry-
203-
204-
- name: Cache cargo build
205-
uses: actions/cache@v4
153+
- name: Setup Rust cache
154+
uses: Swatinem/rust-cache@v2
206155
with:
207-
path: target/
208-
key: cargo-build-check-${{ matrix.name }}-${{ needs.setup-cache.outputs.cache-key }}
209-
restore-keys: |
210-
cargo-build-check-${{ matrix.name }}-
211-
cargo-build-${{ matrix.name }}-
156+
prefix-key: "rust-build-${{ matrix.name }}"
157+
shared-key: ${{ needs.setup-cache.outputs.cache-key }}
212158

213159
- name: Check build
214160
run: cargo +nightly check --workspace --all-features --exclude cortex-gui
@@ -268,28 +214,11 @@ jobs:
268214
- name: Install Rust nightly
269215
uses: dtolnay/rust-toolchain@nightly
270216

271-
- name: Setup sccache
272-
uses: mozilla-actions/sccache-action@v0.0.6
273-
274-
- name: Cache cargo registry & git
275-
uses: actions/cache@v4
276-
with:
277-
path: |
278-
~/.cargo/registry/index/
279-
~/.cargo/registry/cache/
280-
~/.cargo/git/db/
281-
key: cargo-registry-${{ needs.setup-cache.outputs.cache-key }}
282-
restore-keys: |
283-
cargo-registry-
284-
285-
- name: Cache cargo build (GUI)
286-
uses: actions/cache@v4
217+
- name: Setup Rust cache
218+
uses: Swatinem/rust-cache@v2
287219
with:
288-
path: target/
289-
key: cargo-build-gui-${{ matrix.name }}-${{ needs.setup-cache.outputs.cache-key }}
290-
restore-keys: |
291-
cargo-build-gui-${{ matrix.name }}-
292-
cargo-build-${{ matrix.name }}-
220+
prefix-key: "rust-gui-${{ matrix.name }}"
221+
shared-key: ${{ needs.setup-cache.outputs.cache-key }}
293222

294223
- name: Check GUI build
295224
run: cargo +nightly check -p cortex-gui

.github/workflows/release.yml

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ env:
3030
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
3131
# Incremental compilation off for release builds
3232
CARGO_INCREMENTAL: 0
33-
# Use sccache for shared compilation cache
34-
SCCACHE_GHA_ENABLED: "true"
35-
RUSTC_WRAPPER: "sccache"
3633

3734
permissions:
3835
contents: write
@@ -155,27 +152,11 @@ jobs:
155152
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml
156153
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml
157154
158-
- name: Setup sccache
159-
uses: mozilla-actions/sccache-action@v0.0.6
160-
161-
- name: Cache cargo registry & git
162-
uses: actions/cache@v4
155+
- name: Setup Rust cache
156+
uses: Swatinem/rust-cache@v2
163157
with:
164-
path: |
165-
~/.cargo/registry/index/
166-
~/.cargo/registry/cache/
167-
~/.cargo/git/db/
168-
key: cargo-registry-${{ needs.prepare.outputs.cache_key }}
169-
restore-keys: |
170-
cargo-registry-
171-
172-
- name: Cache cargo build
173-
uses: actions/cache@v4
174-
with:
175-
path: target/
176-
key: cargo-release-cli-${{ matrix.target }}-${{ needs.prepare.outputs.cache_key }}
177-
restore-keys: |
178-
cargo-release-cli-${{ matrix.target }}-
158+
prefix-key: "rust-release-cli-${{ matrix.target }}"
159+
shared-key: ${{ needs.prepare.outputs.cache_key }}
179160

180161
- name: Build release binary
181162
run: cargo +nightly build --release --target ${{ matrix.target }} -p cortex-cli
@@ -272,29 +253,14 @@ jobs:
272253
libgtk-3-dev \
273254
libayatana-appindicator3-dev
274255
275-
- name: Setup sccache
276-
uses: mozilla-actions/sccache-action@v0.0.6
277-
278-
- name: Cache cargo registry & git
279-
uses: actions/cache@v4
280-
with:
281-
path: |
282-
~/.cargo/registry/index/
283-
~/.cargo/registry/cache/
284-
~/.cargo/git/db/
285-
key: cargo-registry-${{ needs.prepare.outputs.cache_key }}
286-
restore-keys: |
287-
cargo-registry-
288-
289-
- name: Cache cargo build (GUI)
290-
uses: actions/cache@v4
256+
- name: Setup Rust cache
257+
uses: Swatinem/rust-cache@v2
291258
with:
292-
path: |
293-
target/
294-
cortex-gui/src-tauri/target/
295-
key: cargo-release-gui-${{ matrix.target }}-${{ needs.prepare.outputs.cache_key }}
296-
restore-keys: |
297-
cargo-release-gui-${{ matrix.target }}-
259+
prefix-key: "rust-release-gui-${{ matrix.target }}"
260+
shared-key: ${{ needs.prepare.outputs.cache_key }}
261+
workspaces: |
262+
.
263+
cortex-gui/src-tauri
298264
299265
- name: Cache pnpm
300266
uses: actions/cache@v4

0 commit comments

Comments
 (0)