From b01657d9bb1c81c4e7a46604980d19112a4034f0 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Fri, 12 Jul 2024 08:28:17 +0100 Subject: [PATCH 01/16] Add support for adding to cache key When using this action in multiple matrix jobs in the same workflow, the generated cache key is the same for all of them, because they all get the same job ID. This means that all apart from the first job are unable to save the cache, and subsequent runs might restore the wrong cache. The `Swatinem/rust-cache` action which we use for caching has a `key` input which it puts in its cache key. (It doesn't override the key, just adds to it.) Providing this as an input here will allow us to generate a unique cache key for each job in the matrix. --- README.md | 1 + action.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 5899df0..9298545 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `cache` | Automatically configure Rust cache (using [`Swatinem/rust-cache`]) | true | | `cache-workspaces` | Propagates the value to [`Swatinem/rust-cache`] | | | `cache-on-failure` | Propagates the value to [`Swatinem/rust-cache`] | true | +| `key` | Propagates the value to [`Swatinem/rust-cache`] | | | `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" | diff --git a/action.yml b/action.yml index fa6bd89..c9a28b4 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,9 @@ inputs: description: "Also cache on workflow failures" default: "true" required: false + cache-key: + description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs." + required: false matcher: description: "Enable the Rust problem matcher" required: false @@ -181,3 +184,4 @@ runs: with: workspaces: ${{inputs.cache-workspaces}} cache-on-failure: ${{inputs.cache-on-failure}} + key: ${{inputs.cache-key}} From 5d6934e965a5457a045bd6a3327b3ce9dd0c6cbf Mon Sep 17 00:00:00 2001 From: Fukaya Temma <23367170+pranc1ngpegasus@users.noreply.github.com> Date: Sun, 18 Aug 2024 01:34:59 +0900 Subject: [PATCH 02/16] Able to cache additional directories --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index fa6bd89..8ad465f 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,9 @@ inputs: cache-workspaces: description: "Paths to multiple Cargo workspaces and their target directories, separated by newlines." required: false + cache-directories: + description: "Additional non workspace directories to be cached, separated by newlines." + required: false cache-on-failure: description: "Also cache on workflow failures" default: "true" @@ -180,4 +183,5 @@ runs: uses: Swatinem/rust-cache@v2 with: workspaces: ${{inputs.cache-workspaces}} + cache-directories: ${{inputs.cache-directories}} cache-on-failure: ${{inputs.cache-on-failure}} From 597574aacb4ee305cfa0c6a3ba38e8be6f9a2eb6 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 20 Sep 2024 00:23:09 +0200 Subject: [PATCH 03/16] Update key name in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9298545..7b24bc7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `cache` | Automatically configure Rust cache (using [`Swatinem/rust-cache`]) | true | | `cache-workspaces` | Propagates the value to [`Swatinem/rust-cache`] | | | `cache-on-failure` | Propagates the value to [`Swatinem/rust-cache`] | true | -| `key` | Propagates the value to [`Swatinem/rust-cache`] | | +| `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | | | `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" | From eb4a655afde124c3ebbd7ddebd7ef287d56ac4d6 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 20 Sep 2024 00:27:10 +0200 Subject: [PATCH 04/16] Document new keys and add changelog --- CHANGELOG.md | 3 +++ README.md | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acd52af..4e3c466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +* Add new parameter `cache-directories` that is propagated to `Swatinem/rust-cache` (#44 by @pranc1ngpegasus) +* Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) + ## [1.9.0] - 2024-06-08 * Add extra argument `cache-on-failure` and forward it to `Swatinem/rust-cache`. (#39 by @samuelhnrq) diff --git a/README.md b/README.md index 7b24bc7..3cbc487 100644 --- a/README.md +++ b/README.md @@ -48,17 +48,18 @@ 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` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | 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-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` | | -| `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" | +| Name | Description | Default | +| ------------------- | -------------------------------------------------------------------------------------- | ------------- | +| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | 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` | | +| `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" | [`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache From 86a2ce66737229469494d3779ce1c99c3b5b351d Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 20 Sep 2024 00:39:06 +0200 Subject: [PATCH 05/16] Make toolchain install more robust --- CHANGELOG.md | 1 + action.yml | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3c466..5091e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add new parameter `cache-directories` that is propagated to `Swatinem/rust-cache` (#44 by @pranc1ngpegasus) * Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) +* Make rustup toolchain installation more robust in light of planned changes https://github.com/rust-lang/rustup/issues/3635 and https://github.com/rust-lang/rustup/pull/3985 ## [1.9.0] - 2024-06-08 diff --git a/action.yml b/action.yml index d842f6e..f6929f3 100644 --- a/action.yml +++ b/action.yml @@ -137,8 +137,10 @@ runs: if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]] then # Install the toolchain as specified in the file - # Might break at some point: https://github.com/rust-lang/rustup/issues/1397 - rustup show + # rustup show is the old way that implicitly installed a toolchain + # rustup toolchain install is the new explicit way + # https://github.com/rust-lang/rustup/issues/3635#issuecomment-2343511297 + rustup show active-toolchain || rustup toolchain install if [[ -n $components ]]; then rustup component add ${components//,/ } fi From 9f99923fade1f569928b687ccc2858a192effa02 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 20 Sep 2024 00:46:09 +0200 Subject: [PATCH 06/16] Add pre-commit for basic checks --- .pre-commit-config.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ba2a6f4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-json + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.29.2 + hooks: + - id: check-dependabot + - id: check-github-actions + - id: check-github-workflows From b31b1317f290cc8743fce262ee98435b8c2a3c5a Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Sun, 22 Sep 2024 15:28:43 +0200 Subject: [PATCH 07/16] Allow installing multiple Rust toolchains at once. --- CHANGELOG.md | 1 + README.md | 24 ++++++++++++------------ action.yml | 9 +++++---- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5091e71..997762c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add new parameter `cache-directories` that is propagated to `Swatinem/rust-cache` (#44 by @pranc1ngpegasus) * Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) * Make rustup toolchain installation more robust in light of planned changes https://github.com/rust-lang/rustup/issues/3635 and https://github.com/rust-lang/rustup/pull/3985 +* Allow installing multiple Rust toolchains by specifying multiple versions in the `toolchain` input parameter. ## [1.9.0] - 2024-06-08 diff --git a/README.md b/README.md index 3cbc487..6cacb74 100644 --- a/README.md +++ b/README.md @@ -48,18 +48,18 @@ 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` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | 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` | | -| `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" | +| 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` | | +| `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" | [`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache diff --git a/action.yml b/action.yml index f6929f3..240e88a 100644 --- a/action.yml +++ b/action.yml @@ -13,7 +13,7 @@ branding: # The action is heavily inspired by https://github.com/dtolnay/rust-toolchain inputs: toolchain: - description: "Rust toolchain specification -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification" + description: "Comma-separated list of Rust toolchain specifications. Last version becomes the default. -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification" required: false target: description: "Target triple to install for this toolchain" @@ -80,7 +80,7 @@ runs: : construct rustup command line echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT - echo "downgrade=${{inputs.toolchain == 'nightly' && inputs.components && ' --allow-downgrade' || ''}}" >> $GITHUB_OUTPUT + echo "downgrade=${{contains(inputs.toolchain, 'nightly') && inputs.components && ' --allow-downgrade' || ''}}" >> $GITHUB_OUTPUT # The environment variables always need to be set before the caching action - name: Setting Environment Variables @@ -152,8 +152,9 @@ runs: then toolchain=stable fi - rustup toolchain install $toolchain${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update - rustup override set $toolchain + rustup toolchain install ${toolchain//,/ } ${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update + # Take the last element from the list + rustup override set ${toolchain//*,/ } fi - id: versions From 4d1965c9142484e48d40c19de54b5cba84953a06 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Sun, 22 Sep 2024 16:04:02 +0200 Subject: [PATCH 08/16] Add override input parameter that controls the `rustup override` behavior --- CHANGELOG.md | 1 + README.md | 1 + action.yml | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 997762c..3903da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) * Make rustup toolchain installation more robust in light of planned changes https://github.com/rust-lang/rustup/issues/3635 and https://github.com/rust-lang/rustup/pull/3985 * Allow installing multiple Rust toolchains by specifying multiple versions in the `toolchain` input parameter. +* Configure the `rustup override` behavior via the new `override` input. (#38) ## [1.9.0] - 2024-06-08 diff --git a/README.md b/README.md index 6cacb74..12aca64 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | | | `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 diff --git a/action.yml b/action.yml index 240e88a..21ef752 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,10 @@ inputs: description: "set RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflags" required: false default: "-D warnings" + override: + description: "Setup the last installed toolchain as the default via `rustup override`" + required: false + default: "true" outputs: rustc-version: @@ -132,6 +136,7 @@ runs: toolchain: ${{inputs.toolchain}} targets: ${{inputs.target}} components: ${{inputs.components}} + override: ${{inputs.override}} shell: bash run: | if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]] @@ -154,7 +159,10 @@ runs: fi rustup toolchain install ${toolchain//,/ } ${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update # Take the last element from the list - rustup override set ${toolchain//*,/ } + if [[ "$override" == "true" ]] + then + rustup override set ${toolchain//*,/ } + fi fi - id: versions From 11df97af8e8102fd60b60a77dfbf58d40cd843b8 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Tue, 1 Oct 2024 23:06:20 +0200 Subject: [PATCH 09/16] Update the rustfmt problem matcher https://github.com/rust-lang/rustfmt/pull/5971 https://github.com/actions-rust-lang/rustfmt/issues/5 --- CHANGELOG.md | 8 ++++++++ rust.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3903da1..9ac8d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.10.1] - 2024-10-01 + +* Fix problem matcher for rustfmt output. + The format has changed since https://github.com/rust-lang/rustfmt/pull/5971 and now follows the form "filename:line". + Thanks to @0xcypher02 for pointing out the problem. + +## [1.10.0] - 2024-09-23 + * Add new parameter `cache-directories` that is propagated to `Swatinem/rust-cache` (#44 by @pranc1ngpegasus) * Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) * Make rustup toolchain installation more robust in light of planned changes https://github.com/rust-lang/rustup/issues/3635 and https://github.com/rust-lang/rustup/pull/3985 diff --git a/rust.json b/rust.json index ddaa1b0..c407391 100644 --- a/rust.json +++ b/rust.json @@ -5,7 +5,7 @@ "severity": "warning", "pattern": [ { - "regexp": "^(Diff in (.+)) at line (\\d+):$", + "regexp": "^(Diff in (.+))(?: at line |:)(\\d+):$", "message": 1, "file": 2, "line": 3 From 97db979bf844c838b06022f305ca480d01b4d5fe Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Mon, 21 Oct 2024 23:54:51 +0200 Subject: [PATCH 10/16] Specify dependencies in README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 12aca64..605859d 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,16 @@ You can read more rustflags, and their load order, in the [Cargo reference]. | `rustup-version` | Version as reported by `rustup --version` | | `cachekey` | A short hash of the installed rustc version | +## Dependencies + +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 (Linux and macOS) +* using other node actions + ## License The scripts and documentation in this project are released under the [MIT From f8efd60d2dea71cf378cafb3f494ecf103ae1179 Mon Sep 17 00:00:00 2001 From: skanehira Date: Sat, 8 Feb 2025 01:22:20 +0900 Subject: [PATCH 11/16] feat: add shared-cache-key to inputs --- README.md | 1 + action.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 605859d..209e5d3 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `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` | | +| `shared-cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `shared-key` | | | `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 | diff --git a/action.yml b/action.yml index 21ef752..df6946e 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,9 @@ inputs: cache-key: description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs." required: false + shared-cache-key: + description: "A cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs." + required: false matcher: description: "Enable the Rust problem matcher" required: false @@ -200,3 +203,4 @@ runs: cache-directories: ${{inputs.cache-directories}} cache-on-failure: ${{inputs.cache-on-failure}} key: ${{inputs.cache-key}} + shared-key: ${{inputs.shared-cache-key}} From 30081c4da55e5f2a707c228afc2c7d6f422a676c Mon Sep 17 00:00:00 2001 From: Enkhjil Enkhbaatar Date: Tue, 4 Feb 2025 15:13:57 +0900 Subject: [PATCH 12/16] fix: add cache-bin input with true as default value --- README.md | 1 + action.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 605859d..60f0b0d 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `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-bin` | Propagates the value to [`Swatinem/rust-cache`] | | | `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 | diff --git a/action.yml b/action.yml index 21ef752..1befac2 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,10 @@ inputs: cache-key: description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs." required: false + cache-bin: + description: "Determines whether to cache ${CARGO_HOME}/bin." + required: false + default: "true" matcher: description: "Enable the Rust problem matcher" required: false @@ -199,4 +203,5 @@ runs: workspaces: ${{inputs.cache-workspaces}} cache-directories: ${{inputs.cache-directories}} cache-on-failure: ${{inputs.cache-on-failure}} + cache-bin: ${{inputs.cache-bin}} key: ${{inputs.cache-key}} From 6cbea1a7947962ed471795015128faa83769af2d Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 24 Feb 2025 02:18:45 +0000 Subject: [PATCH 13/16] chore: prepare release 1.11.0 --- CHANGELOG.md | 5 +++++ README.md | 2 +- action.yml | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac8d9f..25142be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.11.0] - 2025-02-24 + +* Add new parameter `cache-bin` that is propagated to `Swatinem/rust-cache` as `cache-bin` (#51 by @enkhjile) +* Add new parameter `cache-shared-key` that is propagated to `Swatinem/rust-cache` as `shared-key` (#52 by @skanehira) + ## [1.10.1] - 2024-10-01 * Fix problem matcher for rustfmt output. diff --git a/README.md b/README.md index 209e5d3..10e7bb2 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `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` | | -| `shared-cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `shared-key` | | +| `cache-shared-key` | Propagates the value to [`Swatinem/rust-cache`] as `shared-key` | | | `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 | diff --git a/action.yml b/action.yml index df6946e..f829e66 100644 --- a/action.yml +++ b/action.yml @@ -38,7 +38,7 @@ inputs: cache-key: description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs." required: false - shared-cache-key: + cache-shared-key: description: "A cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs." required: false matcher: @@ -203,4 +203,4 @@ runs: cache-directories: ${{inputs.cache-directories}} cache-on-failure: ${{inputs.cache-on-failure}} key: ${{inputs.cache-key}} - shared-key: ${{inputs.shared-cache-key}} + shared-key: ${{inputs.cache-shared-key}} From d9c91b20fd575d8e7998826de9744357e3a7a903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Wed, 23 Apr 2025 16:16:31 +0200 Subject: [PATCH 14/16] Support rustup installation for Windows --- action.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index d3aecfe..ca44c3d 100644 --- a/action.yml +++ b/action.yml @@ -130,13 +130,20 @@ runs: run: echo "::add-matcher::${{ github.action_path }}/rust.json" - name: Install rustup, if needed - if: runner.os != 'Windows' shell: bash 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 - echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH + + # 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 + else + echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH + fi fi + env: + RUNNER_OS: "${{ runner.os }}" - name: rustup toolchain install ${{inputs.toolchain || 'stable'}} env: From 9988a3d74bdbde17eac1e61264c78dea69889540 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Wed, 23 Apr 2025 22:42:15 +0200 Subject: [PATCH 15/16] Update the dependency section to mark the new windows rustup support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cfbf823..6f8a15c 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ PRs to add support for more environments are welcome. * bash 5 * brew (macOS only) -* rustup or curl (Linux and macOS) +* rustup or curl * using other node actions ## License From 9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Wed, 23 Apr 2025 22:46:51 +0200 Subject: [PATCH 16/16] Update changelog for windows support --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25142be..a637784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.12.0] - 2025-04-23 + +* Add support for installing rustup on Windows (#58 by @maennchen) + This adds support for using Rust on the GitHub provided Windows ARM runners. + ## [1.11.0] - 2025-02-24 * Add new parameter `cache-bin` that is propagated to `Swatinem/rust-cache` as `cache-bin` (#51 by @enkhjile)