Repository navigation
Give each Rust CI job its own cache and save caches only from main #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b9235ca
Give each Rust CI job its own cache and save caches only from main
dhruv8sh b8dbc19
Merge branch 'main' into chore/ci-per-job-rust-cache
aram356 091e3cd
Merge branch 'main' into chore/ci-per-job-rust-cache
dhruv8sh bcec6ad
Move pinned Rust setup into a shared composite action
dhruv8sh b445b7b
Merge remote-tracking branch 'origin/chore/ci-per-job-rust-cache' int…
dhruv8sh ee2c589
Merge branch 'main' into chore/ci-per-job-rust-cache
aram356 8a2f2b4
Merge branch 'main' into chore/ci-per-job-rust-cache
aram356 bc07274
Require Rust jobs to use the shared setup-rust action
dhruv8sh cc5d9af
Merge branch 'main' into chore/ci-per-job-rust-cache
aram356 1688b33
Catch quoted uses values in the shared Rust setup guard
dhruv8sh b2113dd
Merge branch 'main' into chore/ci-per-job-rust-cache
dhruv8sh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: Set up pinned Rust | ||
| description: Install the .tool-versions Rust toolchain with a per-job cache that only main saves. | ||
|
|
||
| inputs: | ||
| cache-key: | ||
| description: Per-job rust-cache key prefix; the runner OS is appended. | ||
| required: true | ||
| target: | ||
| description: Comma-separated extra targets. | ||
| required: false | ||
| default: "" | ||
| components: | ||
| description: Comma-separated extra components. | ||
| required: false | ||
| default: "" | ||
| save-cache: | ||
| description: Set to "false" for restore-only callers. | ||
| required: false | ||
| default: "true" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Retrieve Rust version | ||
| id: rust-version | ||
| shell: bash | ||
| run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Remove runner-image Rust toolchain | ||
| # rust-cache hashes every installed toolchain into its key, so the image's | ||
| # preinstalled stable would rotate the key on each runner-image rollout. | ||
| # Unsetting the default stops rustup from silently reinstalling stable | ||
| # when cargo runs outside the checkout. | ||
| shell: bash | ||
| run: if command -v rustup >/dev/null; then rustup toolchain uninstall stable && rustup default none; fi | ||
|
|
||
| - name: Set up Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| toolchain: ${{ steps.rust-version.outputs.rust-version }} | ||
| target: ${{ inputs.target }} | ||
| components: ${{ inputs.components }} | ||
| cache-shared-key: ${{ inputs.cache-key }}-${{ runner.os }} | ||
| # PR caches are scoped to their ref and only evict main's shared caches. | ||
| cache-save-if: ${{ inputs.save-cache == 'true' && github.ref == 'refs/heads/main' }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.