1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-18 03:44:05 -05:00

ci: try fix cache (#27348)

This commit is contained in:
David Sherret 2024-12-12 20:12:13 -05:00 committed by GitHub
parent 960776cd32
commit e46f42d052
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 18 deletions

View file

@ -59,6 +59,15 @@ const Runners = {
const prCacheKeyPrefix = const prCacheKeyPrefix =
`${cacheVersion}-cargo-target-\${{ matrix.os }}-\${{ matrix.arch }}-\${{ matrix.profile }}-\${{ matrix.job }}-`; `${cacheVersion}-cargo-target-\${{ matrix.os }}-\${{ matrix.arch }}-\${{ matrix.profile }}-\${{ matrix.job }}-`;
const prCacheKey = `${prCacheKeyPrefix}\${{ github.sha }}`;
const prCachePath = [
// this must match for save and restore (https://github.com/actions/cache/issues/1444)
"./target",
"!./target/*/gn_out",
"!./target/*/gn_root",
"!./target/*/*.zip",
"!./target/*/*.tar.gz",
].join("\n");
// Note that you may need to add more version to the `apt-get remove` line below if you change this // Note that you may need to add more version to the `apt-get remove` line below if you change this
const llvmVersion = 19; const llvmVersion = 19;
@ -612,7 +621,7 @@ const ci = {
`${cacheVersion}-cargo-home-\${{ matrix.os }}-\${{ matrix.arch }}-\${{ hashFiles('Cargo.lock') }}`, `${cacheVersion}-cargo-home-\${{ matrix.os }}-\${{ matrix.arch }}-\${{ hashFiles('Cargo.lock') }}`,
// We will try to restore from the closest cargo-home we can find // We will try to restore from the closest cargo-home we can find
"restore-keys": "restore-keys":
`${cacheVersion}-cargo-home-\${{ matrix.os }}-\${{ matrix.arch }}`, `${cacheVersion}-cargo-home-\${{ matrix.os }}-\${{ matrix.arch }}-`,
}, },
}, },
{ {
@ -622,13 +631,7 @@ const ci = {
if: if:
"github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')", "github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')",
with: { with: {
path: [ path: prCachePath,
"./target",
"!./target/*/gn_out",
"!./target/*/gn_root",
"!./target/*/*.zip",
"!./target/*/*.tar.gz",
].join("\n"),
key: "never_saved", key: "never_saved",
"restore-keys": prCacheKeyPrefix, "restore-keys": prCacheKeyPrefix,
}, },
@ -1080,14 +1083,8 @@ const ci = {
if: if:
"(matrix.job == 'test' || matrix.job == 'lint') && github.ref == 'refs/heads/main'", "(matrix.job == 'test' || matrix.job == 'lint') && github.ref == 'refs/heads/main'",
with: { with: {
path: [ path: prCachePath,
"./target", key: prCacheKey,
"!./target/*/gn_out",
"!./target/*/*.zip",
"!./target/*/*.sha256sum",
"!./target/*/*.tar.gz",
].join("\n"),
key: prCacheKeyPrefix + "${{ github.sha }}",
}, },
}, },
]), ]),

View file

@ -362,7 +362,7 @@ jobs:
~/.cargo/registry/index ~/.cargo/registry/index
~/.cargo/registry/cache ~/.cargo/registry/cache
key: '30-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' key: '30-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}'
restore-keys: '30-cargo-home-${{ matrix.os }}-${{ matrix.arch }}' restore-keys: '30-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-'
if: '!(matrix.skip)' if: '!(matrix.skip)'
- name: Restore cache build output (PR) - name: Restore cache build output (PR)
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
@ -682,8 +682,8 @@ jobs:
path: |- path: |-
./target ./target
!./target/*/gn_out !./target/*/gn_out
!./target/*/gn_root
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.sha256sum
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: '30-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' key: '30-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
publish-canary: publish-canary: