9797 env :
9898 # Speed up repeated builds across CI runs by caching compiled objects (non-Windows).
9999 USE_SCCACHE : ${{ startsWith(matrix.runner, 'windows') && 'false' || 'true' }}
100- RUSTC_WRAPPER : sccache
101100 CARGO_INCREMENTAL : " 0"
102101 SCCACHE_CACHE_SIZE : 10G
103102
@@ -149,36 +148,33 @@ jobs:
149148
150149 steps :
151150 - uses : actions/checkout@v5
152- - name : Disable sccache on Windows
153- if : ${{ env.USE_SCCACHE == 'false' }}
154- shell : pwsh
155- run : " echo 'RUSTC_WRAPPER=' >> $env:GITHUB_ENV"
156151 - uses : dtolnay/rust-toolchain@1.90
157152 with :
158153 targets : ${{ matrix.target }}
159154 components : clippy
160-
161- # Explicitly ensure the stdlib for the requested target is installed.
162- # Newer rustup releases on macOS ended up syncing the default channel
163- # without pulling the cross target, which then caused `can't find crate
164- # for core` failures. Running `rustup target add` here is idempotent and
165- # fixes both macOS cross builds and the linux-musl runners.
166- - name : rustup target add
155+ - name : Ensure rust target std installed
167156 run : rustup target add ${{ matrix.target }}
168157
158+ - name : Free disk space (Linux runners)
159+ if : ${{ startsWith(matrix.runner, 'ubuntu') }}
160+ shell : bash
161+ run : |
162+ set -euxo pipefail
163+ sudo rm -rf /usr/local/lib/android /opt/ghc /usr/share/dotnet /opt/hostedtoolcache/CodeQL || true
164+ df -h
165+
169166 # Explicit cache restore: split cargo home vs target, so we can
170167 # avoid caching the large target dir on the gnu-dev job.
171168 - name : Restore cargo home cache
172169 id : cache_cargo_home_restore
173170 uses : actions/cache/restore@v4
174- continue-on-error : true
175171 with :
176172 path : |
177173 ~/.cargo/bin/
178174 ~/.cargo/registry/index/
179175 ~/.cargo/registry/cache/
180176 ~/.cargo/git/db/
181- key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
177+ key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
182178 restore-keys : |
183179 cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-
184180
@@ -204,14 +200,18 @@ jobs:
204200 echo "Using sccache local disk + actions/cache fallback"
205201 fi
206202
203+ - name : Enable sccache wrapper
204+ if : ${{ env.USE_SCCACHE == 'true' }}
205+ shell : bash
206+ run : echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
207+
207208 - name : Restore sccache cache (fallback)
208209 if : ${{ env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true' }}
209210 id : cache_sccache_restore
210211 uses : actions/cache/restore@v4
211- continue-on-error : true
212212 with :
213213 path : ${{ github.workspace }}/.sccache/
214- key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ github.run_id }}
214+ key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ github.run_id }}
215215 restore-keys : |
216216 sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}-
217217 sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-
@@ -288,15 +288,15 @@ jobs:
288288 ~/.cargo/registry/index/
289289 ~/.cargo/registry/cache/
290290 ~/.cargo/git/db/
291- key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
291+ key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
292292
293293 - name : Save sccache cache (fallback)
294294 if : always() && !cancelled() && env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true'
295295 continue-on-error : true
296296 uses : actions/cache/save@v4
297297 with :
298298 path : ${{ github.workspace }}/.sccache/
299- key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ github.run_id }}
299+ key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ github.run_id }}
300300
301301 - name : sccache stats
302302 if : always() && env.USE_SCCACHE == 'true'
@@ -345,7 +345,6 @@ jobs:
345345 env :
346346 # Speed up repeated builds across CI runs by caching compiled objects (non-Windows).
347347 USE_SCCACHE : ${{ startsWith(matrix.runner, 'windows') && 'false' || 'true' }}
348- RUSTC_WRAPPER : sccache
349348 CARGO_INCREMENTAL : " 0"
350349 SCCACHE_CACHE_SIZE : 10G
351350
@@ -371,25 +370,30 @@ jobs:
371370
372371 steps :
373372 - uses : actions/checkout@v5
374- - name : Disable sccache on Windows
375- if : ${{ env.USE_SCCACHE == 'false' }}
376- shell : pwsh
377- run : " echo 'RUSTC_WRAPPER=' >> $env:GITHUB_ENV"
378373 - uses : dtolnay/rust-toolchain@1.90
379374 with :
380375 targets : ${{ matrix.target }}
376+ - name : Ensure rust target std installed
377+ run : rustup target add ${{ matrix.target }}
378+
379+ - name : Free disk space (Linux runners)
380+ if : ${{ startsWith(matrix.runner, 'ubuntu') }}
381+ shell : bash
382+ run : |
383+ set -euxo pipefail
384+ sudo rm -rf /usr/local/lib/android /opt/ghc /usr/share/dotnet /opt/hostedtoolcache/CodeQL || true
385+ df -h
381386
382387 - name : Restore cargo home cache
383388 id : cache_cargo_home_restore
384389 uses : actions/cache/restore@v4
385- continue-on-error : true
386390 with :
387391 path : |
388392 ~/.cargo/bin/
389393 ~/.cargo/registry/index/
390394 ~/.cargo/registry/cache/
391395 ~/.cargo/git/db/
392- key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
396+ key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
393397 restore-keys : |
394398 cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-
395399
@@ -414,16 +418,20 @@ jobs:
414418 echo "Using sccache local disk + actions/cache fallback"
415419 fi
416420
421+ - name : Enable sccache wrapper
422+ if : ${{ env.USE_SCCACHE == 'true' }}
423+ shell : bash
424+ run : echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
425+
417426 - name : Restore sccache cache (fallback)
418427 if : ${{ env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true' }}
419428 id : cache_sccache_restore
420429 uses : actions/cache/restore@v4
421- continue-on-error : true
422430 with :
423431 path : ${{ github.workspace }}/.sccache/
424- key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ github.run_id }}
432+ key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ github.run_id }}
425433 restore-keys : |
426- sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-
434+ sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-
427435 sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-
428436
429437 - uses : taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2
@@ -448,15 +456,15 @@ jobs:
448456 ~/.cargo/registry/index/
449457 ~/.cargo/registry/cache/
450458 ~/.cargo/git/db/
451- key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
459+ key : cargo-home-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ hashFiles('codex-rs/rust-toolchain.toml') }}
452460
453461 - name : Save sccache cache (fallback)
454462 if : always() && !cancelled() && env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true'
455463 continue-on-error : true
456464 uses : actions/cache/save@v4
457465 with :
458466 path : ${{ github.workspace }}/.sccache/
459- key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('codex-rs /Cargo.lock') }}-${{ github.run_id }}
467+ key : sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('** /Cargo.lock') }}-${{ github.run_id }}
460468
461469 - name : sccache stats
462470 if : always() && env.USE_SCCACHE == 'true'
0 commit comments