Compare commits

..

9 Commits
v1.12 ... v1.14

Author SHA1 Message Date
Jonas Bushart
ac90e63697 Update changelog for v1.14.1 2025-08-28 00:30:26 +02:00
Jonas Bushart
c6aecb0031 Update the dependabot schedule
Run weekly update checks now that actions are pinned by hash instead of major version tag.
2025-08-28 00:23:23 +02:00
Jonas Bushart
8b890917a5 Merge pull request #68 from JohnTitor/pin-actions 2025-08-28 00:18:14 +02:00
Rob Ede
f964086661 Merge branch 'main' into pin-actions 2025-08-26 07:10:09 +01:00
Jonas Bushart
ab6845274e Add new parameters cache-all-crates and cache-workspace-crates
Add new parameters `cache-all-crates` and `cache-workspace-crates` that
are propagated to `Swatinem/rust-cache` as `cache-all-crates` and
`cache-workspace-crates`

Closes #67
2025-08-23 17:08:42 +02:00
Yuki Okushi
eb1c1a5d34 Pin Swatinem/rust-cache action to a full commit SHA 2025-08-22 16:07:16 +09:00
Jonas Bushart
fb51252c7b Update CHANGELOG.md 2025-06-16 23:47:58 +02:00
Jonas Bushart
33b85c358d Merge pull request #65 from mindrunner/main 2025-06-16 23:44:51 +02:00
lukas
82947d77a9 feat: support cache-provider 2025-06-16 08:02:53 +02:00
4 changed files with 58 additions and 28 deletions

View File

@@ -8,4 +8,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
interval: "weekly"

View File

@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.14.1] - 2025-08-28
* Pin `Swatinem/rust-cache` action to a full commit SHA (#68 by @JohnTitor)
## [1.14.0] - 2025-08-23
* Add new parameters `cache-all-crates` and `cache-workspace-crates` that are propagated to `Swatinem/rust-cache` as `cache-all-crates` and `cache-workspace-crates`
## [1.13.0] - 2025-06-16
* Add new parameter `cache-provider` that is propagated to `Swatinem/rust-cache` as `cache-provider` (#65 by @mindrunner)
## [1.12.0] - 2025-04-23
* Add support for installing rustup on Windows (#58 by @maennchen)

View File

@@ -6,7 +6,7 @@ Caching for Rust tools and build artifacts is enabled.
Environment variables are set to optimize the cache hits.
[Problem Matchers] are provided for build messages (cargo, clippy) and formatting (rustfmt).
The action is heavily inspired by *dtolnay*'s <https://github.com/dtolnay/rust-toolchain> and extends it with further features.
The action is heavily inspired by _dtolnay_'s <https://github.com/dtolnay/rust-toolchain> and extends it with further features.
## Example workflow
@@ -48,21 +48,24 @@ If no `toolchain` value or toolchain file is present, it will default to `stable
First, all items specified in the toolchain file are installed.
Afterward, the `components` and `target` specified via inputs are installed in addition to the items from the toolchain file.
| Name | Description | Default |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------- |
| `toolchain` | Comma-separated list of Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. The last version is the default. | stable |
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
| `cache` | Automatically configure Rust cache (using [`Swatinem/rust-cache`]) | true |
| `cache-directories` | Propagates the value to [`Swatinem/rust-cache`] | |
| `cache-workspaces` | Propagates the value to [`Swatinem/rust-cache`] | |
| `cache-on-failure` | Propagates the value to [`Swatinem/rust-cache`] | true |
| `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | |
| `cache-shared-key` | Propagates the value to [`Swatinem/rust-cache`] as `shared-key` | |
| `cache-bin` | Propagates the value to [`Swatinem/rust-cache`] as `cache-bin` | true |
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |
| `override` | Setup the last installed toolchain as the default via `rustup override` | true |
| Name | Description | Default |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------- | ------------- |
| `toolchain` | Comma-separated list of Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. The last version is the default. | stable |
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
| `cache` | Automatically configure Rust cache (using [`Swatinem/rust-cache`]) | true |
| `cache-directories` | Propagates the value to [`Swatinem/rust-cache`] | |
| `cache-workspaces` | Propagates the value to [`Swatinem/rust-cache`] | |
| `cache-on-failure` | Propagates the value to [`Swatinem/rust-cache`] | true |
| `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | |
| `cache-shared-key` | Propagates the value to [`Swatinem/rust-cache`] as `shared-key` | |
| `cache-bin` | Propagates the value to [`Swatinem/rust-cache`] as `cache-bin` | true |
| `cache-provider` | Propagates the value to [`Swatinem/rust-cache`] as `cache-provider` | 'github' |
| `cache-all-crates` | Propagates the value to [`Swatinem/rust-cache`] as `cache-all-crates` | false |
| `cache-workspace-crates` | Propagates the value to [`Swatinem/rust-cache`] as `cache-workspace-crates` | false |
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |
| `override` | Setup the last installed toolchain as the default via `rustup override` | true |
[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache
@@ -71,10 +74,10 @@ Afterward, the `components` and `target` specified via inputs are installed in a
By default, this action sets the `RUSTFLAGS` environment variable to `-D warnings`.
However, rustflags sources are mutually exclusive, so setting this environment variable omits any configuration through `target.*.rustflags` or `build.rustflags`.
* If `RUSTFLAGS` is already set, no modifications of the variable are made and the original value remains.
* If `RUSTFLAGS` is unset and the `rustflags` input is empty (i.e., the empty string), then it will remain unset.
Use this, if you want to prevent the value from being set because you make use of `target.*.rustflags` or `build.rustflags`.
* Otherwise, the environment variable `RUSTFLAGS` is set to the content of `rustflags`.
- If `RUSTFLAGS` is already set, no modifications of the variable are made and the original value remains.
- If `RUSTFLAGS` is unset and the `rustflags` input is empty (i.e., the empty string), then it will remain unset.
Use this, if you want to prevent the value from being set because you make use of `target.*.rustflags` or `build.rustflags`.
- Otherwise, the environment variable `RUSTFLAGS` is set to the content of `rustflags`.
To prevent this from happening, set the `rustflags` input to an empty string, which will
prevent the action from setting `RUSTFLAGS` at all, keeping any existing preferences.
@@ -95,10 +98,10 @@ You can read more rustflags, and their load order, in the [Cargo reference].
The action works best on the GitHub-hosted runners, but can work on self-hosted ones too, provided the necessary dependencies are available.
PRs to add support for more environments are welcome.
* bash 5
* brew (macOS only)
* rustup or curl
* using other node actions
- bash 5
- brew (macOS only)
- rustup or curl
- using other node actions
## License

View File

@@ -32,7 +32,7 @@ inputs:
description: "Additional non workspace directories to be cached, separated by newlines."
required: false
cache-on-failure:
description: "Also cache on workflow failures"
description: "Cache even if the build fails."
default: "true"
required: false
cache-key:
@@ -45,6 +45,18 @@ inputs:
description: "Determines whether to cache ${CARGO_HOME}/bin."
required: false
default: "true"
cache-provider:
description: "Determines which provider to use for caching. Options are github, buildjet, or warpbuild. Defaults to github."
required: false
default: "github"
cache-all-crates:
description: "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached."
required: false
default: "false"
cache-workspace-crates:
description: "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached."
required: false
default: "false"
matcher:
description: "Enable the Rust problem matcher"
required: false
@@ -134,7 +146,7 @@ runs:
run: |
if ! command -v rustup &> /dev/null ; then
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
# Resolve the correct CARGO_HOME path depending on OS
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "${CARGO_HOME:-$USERPROFILE/.cargo}/bin" | sed 's|/|\\|g' >> $GITHUB_PATH
@@ -208,11 +220,14 @@ runs:
- name: Setup Rust Caching
if: inputs.cache == 'true'
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:
workspaces: ${{inputs.cache-workspaces}}
cache-directories: ${{inputs.cache-directories}}
cache-on-failure: ${{inputs.cache-on-failure}}
cache-bin: ${{inputs.cache-bin}}
cache-provider: ${{inputs.cache-provider}}
cache-all-crates: ${{inputs.cache-all-crates}}
cache-workspace-crates: ${{inputs.cache-workspace-crates}}
key: ${{inputs.cache-key}}
shared-key: ${{inputs.cache-shared-key}}