diff --git a/CHANGELOG.md b/CHANGELOG.md index 3903da1..a637784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ 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) +* 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. + 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/README.md b/README.md index 12aca64..6f8a15c 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ 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-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 | @@ -88,6 +90,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 +* using other node actions + ## License The scripts and documentation in this project are released under the [MIT diff --git a/action.yml b/action.yml index 21ef752..ca44c3d 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,13 @@ 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-shared-key: + description: "A cache key that is used instead of the automatic `job`-based key, and is stable over multiple 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 @@ -123,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: @@ -199,4 +213,6 @@ 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}} + shared-key: ${{inputs.cache-shared-key}} 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