Skip to content

Commit

Permalink
CI: Run setup-rust-toolchain from fork with cache key support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iainlane committed Jul 12, 2024
1 parent 2679618 commit 84313b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ runs:
- name: Set Rust toolchain up
if: steps.cache.outputs.cache-hit != 'true'
uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
# uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
# Run from fork which contains
# https://github.com/actions-rust-lang/setup-rust-toolchain/pull/41 to
# allow us to disamgiuate cache keys when running in multiple jobs
uses: iainlane/setup-rust-toolchain@/d4e530262382bb10ab572c928e42bf70b5bec312
with:
components: rustfmt
target: ${{ inputs.target }}
key: ${{ runner.os }}-${{ inputs.target }}

- name: Install cross toolchain
if:
Expand Down

0 comments on commit 84313b1

Please sign in to comment.