Skip to content

Commit f8c0019

Browse files
committed
chore(ci): Restrict use of rust-cache to longest-running jobs
Spin CI currently always exceeds the 10GB cache quota. That means that between creating a cache entry and trying to use it, it has pretty much always been LRU evicted, so we pay for creating the entries, and never benefit from them. Or rather, that would be the situation if GitHub strictly enforced the cache limits. They apparently are planning on doing so starting in mid-October. Currently, we sometimes get eviction before any use, sometimes not. This change makes it so that only the two longest-running jobs use the cache, and that it's only saved on `main`. In combination, we should get much better hit rates for those two jobs, which should hopefully mean that CI most of the time completes in a bit more than 30 minutes, instead of frequently taking close to an hour. Signed-off-by: Till Schneidereit <[email protected]>
1 parent 5430ac1 commit f8c0019

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

.github/actions/spin-ci-dependencies/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ runs:
114114
if: ${{ inputs.rust-cache == 'true' }}
115115
with:
116116
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock', './os-release') }}"
117+
save-if: ${{ github.ref == 'refs/heads/main' }}
117118

118119
## Install nomad
119120
- name: Install nomad

.github/workflows/build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ jobs:
4444
with:
4545
rust: true
4646
rust-wasm: true
47-
rust-cache: true
4847

4948
- name: Run lints on main code
5049
run: BUILD_SPIN_EXAMPLES=0 make lint
@@ -64,7 +63,6 @@ jobs:
6463
with:
6564
rust: true
6665
rust-wasm: true
67-
rust-cache: true
6866

6967
- name: Cargo Build
7068
run: cargo build --workspace --release --all-targets --features openssl/vendored --features all-tests
@@ -99,7 +97,6 @@ jobs:
9997
with:
10098
rust: true
10199
rust-cross: true
102-
rust-cache: true
103100

104101
- name: Cargo Build
105102
run: cross build --target ${{ matrix.config.target }} --release --features openssl/vendored
@@ -127,7 +124,7 @@ jobs:
127124
with:
128125
rust: true
129126
rust-wasm: true
130-
rust-cache: true
127+
rust-cache: "${{ matrix.os == 'windows-latest' }} || ${{ matrix.os == 'macos-13' }}"
131128
openssl-windows: "${{ matrix.os == 'windows-latest' }}"
132129

133130
- name: Cargo Build
@@ -156,7 +153,6 @@ jobs:
156153
with:
157154
rust: true
158155
rust-wasm: true
159-
rust-cache: true
160156
nomad: true
161157

162158
- name: Check disk space (Before)

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ jobs:
331331
with:
332332
rust: true
333333
rust-cross: true
334-
rust-cache: true
335334

336335
- name: Cargo Build
337336
run: cross build --target ${{ matrix.config.target }} --release --features openssl/vendored

0 commit comments

Comments
 (0)