Skip to content

Commit eefcd5e

Browse files
committed
CI: Run setup-rust-toolchain from fork with cache key support
We run the build for amd64 and arm64, and we use `setup-rust-toolchain` to install and cache the Rust toolchain and project dependencies. The caching part of that action doesn't currently work if it's run in multiple jobs from the same workflow run. The cache key doesn't contain anything that would disambiguate and there is no input to `setup-rust-toolchain` to allow it to be customised. To fix that, I've just [submitted a PR][PR] to the action to allow the cache key to be customised. This will allow us to set a key that includes the OS and architecture of the build, so that the caches are kept separate. We're making use of that here. [PR]: actions-rust-lang/setup-rust-toolchain#41
1 parent 2679618 commit eefcd5e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.devcontainer/devcontainer-lock.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"version": "1.5.0",
1010
"resolved": "ghcr.io/devcontainers/features/node@sha256:a124954d7ed085eb90e08e6fcecac8cbcbb866317ab16deb2c7797d63cbf35d6",
1111
"integrity": "sha256:a124954d7ed085eb90e08e6fcecac8cbcbb866317ab16deb2c7797d63cbf35d6"
12+
},
13+
"ghcr.io/devcontainers/features/rust:1": {
14+
"version": "1.2.0",
15+
"resolved": "ghcr.io/devcontainers/features/rust@sha256:87e1306eef9c1bbc3896e65af91c520f2e78f520d1c2e183ee27c2b11a9397ef",
16+
"integrity": "sha256:87e1306eef9c1bbc3896e65af91c520f2e78f520d1c2e183ee27c2b11a9397ef"
1217
}
1318
}
1419
}

.github/actions/build/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ runs:
4141
4242
- name: Set Rust toolchain up
4343
if: steps.cache.outputs.cache-hit != 'true'
44-
uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
44+
# uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
45+
# Run from fork which contains
46+
# https://github.com/actions-rust-lang/setup-rust-toolchain/pull/41 to
47+
# allow us to disamgiuate cache keys when running in multiple jobs
48+
uses: iainlane/setup-rust-toolchain@d4e530262382bb10ab572c928e42bf70b5bec312
4549
with:
4650
components: rustfmt
4751
target: ${{ inputs.target }}
52+
key: ${{ runner.os }}-${{ inputs.target }}
4853

4954
- name: Install cross toolchain
5055
if:

0 commit comments

Comments
 (0)