2121 uses : actions/setup-go@v6
2222 with :
2323 go-version-file : " go.mod"
24+ # The Go caches are managed by the explicit cache steps below.
25+ cache : false
2426
2527 - name : Install wasm-ld
2628 run : |
@@ -39,26 +41,40 @@ runs:
3941 version : v1.0.0
4042
4143 - name : Install cbindgen
42- run : cargo install --force cbindgen
43- shell : bash
44+ uses : taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2
45+ with :
46+ tool : cbindgen@0.29
4447
4548 - name : Cache Go build
4649 uses : actions/cache@v5
4750 with :
4851 path : ~/.cache/go-build
49- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
52+ # github.sha prevents exact-key hits, which would skip the save and
53+ # let the cache go stale.
54+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ github.sha }}
55+ # Stale restores are safe: the build cache is content-addressed.
56+ restore-keys : |
57+ ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-
58+ ${{ runner.os }}-go-
59+
60+ - name : Cache Go modules
61+ uses : actions/cache@v5
62+ with :
63+ path : ~/go/pkg/mod
64+ # The module cache is determined by go.sum, so an exact key suffices.
65+ key : ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
66+ restore-keys : ${{ runner.os }}-go-mod-
5067
51- - name : Cache Rust build
68+ # Crate sources are immutable, so stale restores are safe.
69+ - name : Cache Cargo registry
5270 uses : actions/cache@v5
5371 with :
5472 path : |
55- ~/.cargo/
56- target/
57- crates/wasm-libraries/target/
58- crates/wasm-libraries/soft-float/
59- target/etc/initial-machine-cache/
60- /home/runner/.rustup/toolchains/
61- key : ${{ runner.os }}-cargo-${{ steps.install-rust.outputs.version }}-${{ hashFiles('Cargo.lock') }}
73+ ~/.cargo/registry/index/
74+ ~/.cargo/registry/cache/
75+ ~/.cargo/git/db/
76+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
77+ restore-keys : ${{ runner.os }}-cargo-registry-
6278
6379 - name : Cache cbrotli
6480 id : cache-cbrotli
0 commit comments