Skip to content

Commit bb0693c

Browse files
committed
ci: move Rust caching into our setup action
To avoid duplicative content. And add comments for why we're changing some of the options. Signed-off-by: Colin Walters <[email protected]>
1 parent c17e631 commit bb0693c

File tree

2 files changed

+10
-30
lines changed

2 files changed

+10
-30
lines changed

.github/actions/bootc-ubuntu-setup/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ runs:
4545
id: set_arch
4646
shell: bash
4747
run: echo "ARCH=$(arch)" >> $GITHUB_ENV
48+
# We often use Rust, so set up opinionated default caching
49+
- name: Setup Rust cache
50+
uses: Swatinem/rust-cache@v2
51+
with:
52+
cache-all-crates: true
53+
# Only generate caches on push to git main
54+
save-if: ${{ github.ref == 'refs/heads/main' }}
55+
# Suppress actually using the cache for builds running from
56+
# git main so that we avoid incremental compilation bugs
57+
lookup-only: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/ci.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ jobs:
3232
- uses: actions/checkout@v4
3333
- name: Bootc Ubuntu Setup
3434
uses: ./.github/actions/bootc-ubuntu-setup
35-
- name: Setup Rust cache
36-
uses: Swatinem/rust-cache@v2
37-
with:
38-
cache-all-crates: true
39-
save-if: ${{ github.ref == 'refs/heads/main' }}
40-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
4135
- name: Validate (default)
4236
run: just validate
4337
# Build container with continuous repository enabled
@@ -47,12 +41,6 @@ jobs:
4741
- uses: actions/checkout@v4
4842
- name: Bootc Ubuntu Setup
4943
uses: ./.github/actions/bootc-ubuntu-setup
50-
- name: Setup Rust cache
51-
uses: Swatinem/rust-cache@v2
52-
with:
53-
cache-all-crates: true
54-
save-if: ${{ github.ref == 'refs/heads/main' }}
55-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
5644
- name: Build with continuous repo enabled
5745
run: sudo just build --build-arg=continuous_repo=1
5846
# Check for security vulnerabilities and license compliance
@@ -74,12 +62,6 @@ jobs:
7462
uses: actions/checkout@v4
7563
- name: Bootc Ubuntu Setup
7664
uses: ./.github/actions/bootc-ubuntu-setup
77-
- name: Setup Rust cache
78-
uses: Swatinem/rust-cache@v2
79-
with:
80-
cache-all-crates: true
81-
save-if: ${{ github.ref == 'refs/heads/main' }}
82-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
8365
- name: Enable fsverity for /
8466
run: sudo tune2fs -O verity $(findmnt -vno SOURCE /)
8567
- name: Install utils
@@ -133,12 +115,6 @@ jobs:
133115
- uses: actions/checkout@v4
134116
- name: Bootc Ubuntu Setup
135117
uses: ./.github/actions/bootc-ubuntu-setup
136-
- name: Setup Rust cache
137-
uses: Swatinem/rust-cache@v2
138-
with:
139-
cache-all-crates: true
140-
save-if: ${{ github.ref == 'refs/heads/main' }}
141-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
142118
- name: Build mdbook
143119
run: just build-mdbook
144120
# Build containers and disk images for integration testing across OS matrix
@@ -154,12 +130,6 @@ jobs:
154130
- uses: actions/checkout@v4
155131
- name: Bootc Ubuntu Setup
156132
uses: ./.github/actions/bootc-ubuntu-setup
157-
- name: Setup Rust cache
158-
uses: Swatinem/rust-cache@v2
159-
with:
160-
cache-all-crates: true
161-
save-if: ${{ github.ref == 'refs/heads/main' }}
162-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
163133
- name: Install qemu-utils
164134
run: sudo apt install -y qemu-utils
165135

0 commit comments

Comments
 (0)