Merge pull request #19 from actions-rust-lang/better-toolchain-support

This commit is contained in:
Jonas Bushart 2023-05-29 20:43:47 +02:00 committed by GitHub
commit cf60eafd0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View File

@ -48,6 +48,7 @@ jobs:
id: toolchain
with:
toolchain: ${{matrix.rust}}
components: clippy
- name: Check ${{'${{steps.toolchain.outputs.rustc-version}}'}}
run: echo '${{steps.toolchain.outputs.rustc-version}}'
- name: Check ${{'${{steps.toolchain.outputs.cargo-version}}'}}
@ -62,4 +63,4 @@ jobs:
# Add tiny empty crate.
# This checks that registry access works.
- run: cargo add serde_as
- run: cargo check
- run: cargo clippy

View File

@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.5.0] - 2023-05-29
### Added
* Support installing additional components and targets that are not listed in `rust-toolchain` (#14)
Before only the items listed in `rust-toolchain` were installed.
Now all the items from the toolchain file are installed and then all the `target`s and `components` that are provided as action inputs.
This allows installing extra tools only for CI or simplify testing special targets in CI.
## [1.4.4] - 2023-03-18
### Fixed

View File

@ -42,8 +42,9 @@ jobs:
## Inputs
All inputs are optional.
If a [toolchain file](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) (i.e., `rust-toolchain` or `rust-toolchain.toml`) is found in the root of the repository, it takes precedence.
All input values are ignored if a toolchain file exists.
If a [toolchain file](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) (i.e., `rust-toolchain` or `rust-toolchain.toml`) is found in the root of the repository, its `toolchain` value takes precedence.
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 |
| ------------ | --------------------------------------------------------------------------------- | ------- |

View File

@ -108,10 +108,19 @@ runs:
# Install the toolchain as specified in the file
# Might break at some point: https://github.com/rust-lang/rustup/issues/1397
rustup show
if [[ -n $components ]]; then
rustup component add ${components//,/ }
fi
if [[ -n $targets ]]; then
rustup target add ${targets//,/ }
fi
else
rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
rustup default ${{inputs.toolchain}}
fi
env:
targets: ${{inputs.target}}
components: ${{inputs.components}}
shell: bash
- name: Print installed versions