1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

chore: No longer need a sparse checkout thanks to cargo sparse index (#19423)

`cargo`'s sparse index showed up in 1.68
This commit is contained in:
Matt Mastracci 2023-06-12 15:59:34 -06:00 committed by GitHub
parent 45e15674b7
commit e8ed59208c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 32 deletions

View file

@ -5,7 +5,7 @@ import * as yaml from "https://deno.land/std@0.173.0/encoding/yaml.ts";
// Bump this number when you want to purge the cache. // Bump this number when you want to purge the cache.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version // Note: the tools/release/01_bump_crate_versions.ts script will update this version
// automatically via regex, so ensure that this line maintains this format. // automatically via regex, so ensure that this line maintains this format.
const cacheVersion = 38; const cacheVersion = 39;
const Runners = (() => { const Runners = (() => {
const ubuntuRunner = "ubuntu-22.04"; const ubuntuRunner = "ubuntu-22.04";
@ -488,13 +488,15 @@ const ci = {
uses: "actions/cache@v3", uses: "actions/cache@v3",
with: { with: {
// See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci // See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
// Note that with the new sparse registry format, we no longer have to cache a `.git` dir
path: [ path: [
"~/.cargo/registry/index", "~/.cargo/registry/index",
"~/.cargo/registry/cache", "~/.cargo/registry/cache",
"~/.cargo/git/db",
].join("\n"), ].join("\n"),
key: key:
`${cacheVersion}-cargo-home-\${{ matrix.os }}-\${{ hashFiles('Cargo.lock') }}`, `${cacheVersion}-cargo-home-\${{ matrix.os }}-\${{ hashFiles('Cargo.lock') }}`,
// We will try to restore from the closest cargo-home we can find
"restore-keys": `${cacheVersion}-cargo-home-\${{ matrix.os }}`,
}, },
}, },
{ {
@ -522,23 +524,6 @@ const ci = {
"cache-path": "./target", "cache-path": "./target",
}, },
}, },
{
// Shallow the cloning the crates.io index makes CI faster because it
// obviates the need for Cargo to clone the index. If we don't do this
// Cargo will `git clone` the github repository that contains the entire
// history of the crates.io index from github. We don't believe the
// identifier '1ecc6299db9ec823' will ever change, but if it does then this
// command must be updated.
name: "Shallow clone crates.io index",
run: [
"if [ ! -d ~/.cargo/registry/index/github.com-1ecc6299db9ec823/.git ]",
"then",
" git clone --depth 1 --no-checkout \\",
" https://github.com/rust-lang/crates.io-index \\",
" ~/.cargo/registry/index/github.com-1ecc6299db9ec823",
"fi",
].join("\n"),
},
{ {
name: "test_format.js", name: "test_format.js",
if: "matrix.job == 'lint'", if: "matrix.job == 'lint'",

View file

@ -298,8 +298,8 @@ jobs:
path: |- path: |-
~/.cargo/registry/index ~/.cargo/registry/index
~/.cargo/registry/cache ~/.cargo/registry/cache
~/.cargo/git/db key: '39-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}'
key: '38-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}' restore-keys: '39-cargo-home-${{ matrix.os }}'
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)'
- name: Restore cache build output (PR) - name: Restore cache build output (PR)
uses: actions/cache/restore@v3 uses: actions/cache/restore@v3
@ -311,21 +311,12 @@ jobs:
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: never_saved key: never_saved
restore-keys: '38-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-' restore-keys: '39-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-'
- name: Apply and update mtime cache - name: Apply and update mtime cache
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (!startsWith(github.ref, ''refs/tags/''))' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (!startsWith(github.ref, ''refs/tags/''))'
uses: ./.github/mtime_cache uses: ./.github/mtime_cache
with: with:
cache-path: ./target cache-path: ./target
- name: Shallow clone crates.io index
run: |-
if [ ! -d ~/.cargo/registry/index/github.com-1ecc6299db9ec823/.git ]
then
git clone --depth 1 --no-checkout \
https://github.com/rust-lang/crates.io-index \
~/.cargo/registry/index/github.com-1ecc6299db9ec823
fi
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)'
- name: test_format.js - name: test_format.js
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (matrix.job == ''lint'')' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (matrix.job == ''lint'')'
run: deno run --unstable --allow-write --allow-read --allow-run ./tools/format.js --check run: deno run --unstable --allow-write --allow-read --allow-run ./tools/format.js --check
@ -601,7 +592,7 @@ jobs:
!./target/*/gn_out !./target/*/gn_out
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: '38-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' key: '39-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
publish-canary: publish-canary:
name: publish canary name: publish canary
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04