Compare commits
3 Commits
86a2ce6673
...
4d1965c914
Author | SHA1 | Date |
---|---|---|
Jonas Bushart | 4d1965c914 | |
Jonas Bushart | b31b1317f2 | |
Jonas Bushart | 9f99923fad |
|
@ -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
|
|
@ -10,6 +10,8 @@ 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-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)
|
* 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
|
* 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
|
## [1.9.0] - 2024-06-08
|
||||||
|
|
||||||
|
|
25
README.md
25
README.md
|
@ -48,18 +48,19 @@ If no `toolchain` value or toolchain file is present, it will default to `stable
|
||||||
First, all items specified in the toolchain file are installed.
|
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.
|
Afterward, the `components` and `target` specified via inputs are installed in addition to the items from the toolchain file.
|
||||||
|
|
||||||
| Name | Description | Default |
|
| Name | Description | Default |
|
||||||
| ------------------- | -------------------------------------------------------------------------------------- | ------------- |
|
| ------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------- |
|
||||||
| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable |
|
| `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` | |
|
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
|
||||||
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
|
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
|
||||||
| `cache` | Automatically configure Rust cache (using [`Swatinem/rust-cache`]) | true |
|
| `cache` | Automatically configure Rust cache (using [`Swatinem/rust-cache`]) | true |
|
||||||
| `cache-directories` | Propagates the value to [`Swatinem/rust-cache`] | |
|
| `cache-directories` | Propagates the value to [`Swatinem/rust-cache`] | |
|
||||||
| `cache-workspaces` | 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-on-failure` | Propagates the value to [`Swatinem/rust-cache`] | true |
|
||||||
| `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | |
|
| `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | |
|
||||||
| `matcher` | Enable problem matcher to surface build messages and formatting issues | 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" |
|
| `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
|
[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache
|
||||||
|
|
||||||
|
|
17
action.yml
17
action.yml
|
@ -13,7 +13,7 @@ branding:
|
||||||
# The action is heavily inspired by https://github.com/dtolnay/rust-toolchain
|
# The action is heavily inspired by https://github.com/dtolnay/rust-toolchain
|
||||||
inputs:
|
inputs:
|
||||||
toolchain:
|
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
|
required: false
|
||||||
target:
|
target:
|
||||||
description: "Target triple to install for this toolchain"
|
description: "Target triple to install for this toolchain"
|
||||||
|
@ -46,6 +46,10 @@ inputs:
|
||||||
description: "set RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflags"
|
description: "set RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflags"
|
||||||
required: false
|
required: false
|
||||||
default: "-D warnings"
|
default: "-D warnings"
|
||||||
|
override:
|
||||||
|
description: "Setup the last installed toolchain as the default via `rustup override`"
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
rustc-version:
|
rustc-version:
|
||||||
|
@ -80,7 +84,7 @@ runs:
|
||||||
: construct rustup command line
|
: construct rustup command line
|
||||||
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
|
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 "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
|
# The environment variables always need to be set before the caching action
|
||||||
- name: Setting Environment Variables
|
- name: Setting Environment Variables
|
||||||
|
@ -132,6 +136,7 @@ runs:
|
||||||
toolchain: ${{inputs.toolchain}}
|
toolchain: ${{inputs.toolchain}}
|
||||||
targets: ${{inputs.target}}
|
targets: ${{inputs.target}}
|
||||||
components: ${{inputs.components}}
|
components: ${{inputs.components}}
|
||||||
|
override: ${{inputs.override}}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
|
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
|
||||||
|
@ -152,8 +157,12 @@ runs:
|
||||||
then
|
then
|
||||||
toolchain=stable
|
toolchain=stable
|
||||||
fi
|
fi
|
||||||
rustup toolchain install $toolchain${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
|
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
|
# Take the last element from the list
|
||||||
|
if [[ "$override" == "true" ]]
|
||||||
|
then
|
||||||
|
rustup override set ${toolchain//*,/ }
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- id: versions
|
- id: versions
|
||||||
|
|
Loading…
Reference in New Issue