File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -302,10 +302,22 @@ jobs:
302302 - name : Checkout sources
303303 uses : actions/checkout@v4
304304
305+ # Cargo doesn't know when to rebuild a target-cpu=native cache when it's
306+ # migrated across machines, so a CI node must not be exposed to the target
307+ # directory generated by another CI node in target-cpu=native mode.
308+ - name : Avoid abusive caching with target-cpu=native
309+ run : |
310+ if [[ ${RUSTFLAGS} =~ '-C target-cpu=native' ]]; then
311+ cp /proc/cpuinfo cpuinfo.key
312+ else
313+ echo "Generic x86_64" >cpuinfo.key
314+ fi
315+
305316 - name : Set up toolchain
306317 uses : actions-rust-lang/setup-rust-toolchain@v1
307318 with :
308319 toolchain : ${{ matrix.toolchain }}
320+ cache-key : ${{ hashFiles(cpuinfo.key) }}
309321
310322 - name : Run tests
311323 run : cargo test --workspace ${{ matrix.cargo-flags }}
You can’t perform that action at this time.
0 commit comments