Skip to content

Commit

Permalink
CI: Improve caching
Browse files Browse the repository at this point in the history
The cache key now depends on the Rust version.
  • Loading branch information
YtvwlD committed Jun 14, 2024
1 parent d9429a7 commit 6eaa050
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 46 deletions.
35 changes: 12 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Cache Cargo
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install qemu
run: sudo apt-get update && sudo apt-get install -y qemu-system-x86
- name: Enable KVM group perms
Expand All @@ -36,15 +33,12 @@ jobs:
needs: test
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Cache Cargo
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build for i686
uses: clechasseur/rs-cargo@v2
with:
Expand Down Expand Up @@ -100,19 +94,14 @@ jobs:
needs: test
steps:
- uses: actions/checkout@v4
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust for x86_64-apple and aarch64-apple
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-apple-darwin, aarch64-apple-darwin
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build towbootctl for x86_64-apple
uses: clechasseur/rs-cargo@v2
with:
Expand Down
35 changes: 12 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Cache Cargo
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ vars.GITHUB_RUN_ID }}-${{ hashFiles('**/Cargo.lock') }}
shared-key: cargo-${{ vars.GITHUB_RUN_ID }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install qemu
run: sudo apt-get update && sudo apt-get install -y qemu-system-x86
- name: Enable KVM group perms
Expand All @@ -38,15 +35,12 @@ jobs:
needs: test
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Cache Cargo
uses: actions/cache@v4
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ vars.GITHUB_RUN_ID }}-${{ hashFiles('**/Cargo.lock') }}
shared-key: cargo-${{ vars.GITHUB_RUN_ID }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build for i686
uses: clechasseur/rs-cargo@v2
with:
Expand Down Expand Up @@ -99,19 +93,14 @@ jobs:
needs: release
steps:
- uses: actions/checkout@v4
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ vars.GITHUB_RUN_ID }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust for x86_64-apple and aarch64-apple
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-apple-darwin, aarch64-apple-darwin
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-${{ vars.GITHUB_RUN_ID }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build towbootctl for x86_64-apple
uses: clechasseur/rs-cargo@v2
with:
Expand Down

0 comments on commit 6eaa050

Please sign in to comment.