Skip to content

Commit 139e5f5

Browse files
committed
CI: Update caching and trim unnecessary cache bits
Use cargo-cache to speed up the caches by trimming unnecessary copies of stuff. Also make it clearer that the gits cache is for git repos, not the index. Signed-off-by: Daniel Silverstone <[email protected]>
1 parent 3008ac7 commit 139e5f5

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

ci/actions-templates/linux-builds-template.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ jobs:
7676
uses: actions/cache@v1
7777
with:
7878
path: ~/.cargo/registry
79-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
80-
- name: Cache cargo index
79+
key: ${{ runner.os }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
80+
- name: Cache cargo git trees
8181
uses: actions/cache@v1
8282
with:
8383
path: ~/.cargo/git
84-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
84+
key: ${{ runner.os }}-cargo-gits-trimmed-${{ hashFiles('**/Cargo.lock') }}
8585
- name: Cache cargo build
8686
uses: actions/cache@v1
8787
with:
8888
path: target
89-
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
89+
key: ${{ runner.os }}-cargo-build-trimmed-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
9090
- name: Install Rustup using ./rustup-init.sh
9191
run: |
9292
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -152,3 +152,7 @@ jobs:
152152
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
153153
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
154154
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
155+
- name: Clear the cargo caches
156+
run: |
157+
cargo install cargo-cache --no-default-features --features ci-autoclean
158+
cargo-cache

ci/actions-templates/macos-builds-template.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ jobs:
4545
uses: actions/cache@v1
4646
with:
4747
path: ~/.cargo/registry
48-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
49-
- name: Cache cargo index
48+
key: ${{ runner.os }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
49+
- name: Cache cargo git trees
5050
uses: actions/cache@v1
5151
with:
5252
path: ~/.cargo/git
53-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
53+
key: ${{ runner.os }}-cargo-gits-trimmed-${{ hashFiles('**/Cargo.lock') }}
5454
- name: Cache cargo build
5555
uses: actions/cache@v1
5656
with:
5757
path: target
58-
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
58+
key: ${{ runner.os }}-cargo-build-trimmed-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
5959
- name: Install Rustup using ./rustup-init.sh
6060
run: |
6161
sh ./rustup-init.sh --default-toolchain=stable --profile=minimal -y
@@ -77,3 +77,7 @@ jobs:
7777
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
7878
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7979
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
80+
- name: Clear the cargo caches
81+
run: |
82+
cargo install cargo-cache --no-default-features --features ci-autoclean
83+
cargo-cache

ci/actions-templates/windows-builds-template.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ jobs:
7575
uses: actions/cache@v1
7676
with:
7777
path: ~/.cargo/registry
78-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
79-
- name: Cache cargo index
78+
key: ${{ runner.os }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
79+
- name: Cache cargo git trees
8080
uses: actions/cache@v1
8181
with:
8282
path: ~/.cargo/git
83-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
83+
key: ${{ runner.os }}-cargo-gits-trimmed-${{ hashFiles('**/Cargo.lock') }}
8484
- name: Cache cargo build
8585
uses: actions/cache@v1
8686
with:
8787
path: target
88-
key: ${{ runner.os }}-cargo-build-static-crt-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
88+
key: ${{ runner.os }}-cargo-build-static-crt-trimmed-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
8989
- name: Install Rustup using win.rustup.rs
9090
run: |
9191
# Disable the download progress bar which can cause perf issues
@@ -180,3 +180,7 @@ jobs:
180180
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
181181
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
182182
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
183+
- name: Clear the cargo caches
184+
run: |
185+
cargo install cargo-cache --no-default-features --features ci-autoclean
186+
cargo-cache

0 commit comments

Comments
 (0)