Merge pull request #2 from actions-rust-lang/support-toolchain-file
Add support for toolchain files
This commit is contained in:
commit
2f56cd1b8a
|
@ -13,9 +13,28 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
rust: [nightly, beta, stable]
|
rust: [
|
||||||
|
# Test with toolchain file override
|
||||||
|
"1.50",
|
||||||
|
"nightly",
|
||||||
|
"beta",
|
||||||
|
"stable",
|
||||||
|
]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
# Test toolchain file support
|
||||||
|
- name: Write rust-toolchain.toml
|
||||||
|
run: |
|
||||||
|
cat <<EOF >>rust-toolchain.toml
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly-2020-07-10"
|
||||||
|
components = [ "rustfmt", "rustc-dev" ]
|
||||||
|
targets = [ "wasm32-unknown-unknown", "thumbv2-none-eabi" ]
|
||||||
|
profile = "minimal"
|
||||||
|
EOF
|
||||||
|
shell: bash
|
||||||
|
if: matrix.rust == '1.50'
|
||||||
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
name: Run actions-rust-lang/setup-rust-toolchain ${{matrix.rust}}
|
name: Run actions-rust-lang/setup-rust-toolchain ${{matrix.rust}}
|
||||||
id: toolchain
|
id: toolchain
|
||||||
|
|
|
@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.2.0] - 2022-07-21
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Prefer toolchain definitions in `rust-toolchain` or `rust-toolchain.toml` files ([Toolchain File](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file)).
|
||||||
|
Other input values are ignored if either file is found.
|
||||||
|
|
||||||
## [1.1.0] - 2022-07-19
|
## [1.1.0] - 2022-07-19
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -29,6 +29,8 @@ jobs:
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
All inputs are optional.
|
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.
|
||||||
|
|
||||||
| Name | Description | Default |
|
| Name | Description | Default |
|
||||||
| ------------ | --------------------------------------------------------------------------------- | ------- |
|
| ------------ | --------------------------------------------------------------------------------- | ------- |
|
||||||
|
|
27
action.yml
27
action.yml
|
@ -60,22 +60,29 @@ runs:
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: rustup toolchain install ${{inputs.toolchain}}
|
- name: rustup toolchain install ${{inputs.toolchain}}
|
||||||
run: |
|
run: |
|
||||||
rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
|
if [[ -f "rust-toolchain" || -f "rust-toolchain.toml" ]]
|
||||||
rustup default ${{inputs.toolchain}}
|
then
|
||||||
|
# Install the toolchain as specified in the file
|
||||||
|
# Might break at some point: https://github.com/rust-lang/rustup/issues/1397
|
||||||
|
rustup show
|
||||||
|
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
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Print installed versions
|
- name: Print installed versions
|
||||||
id: versions
|
id: versions
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=rustc-version::$(rustc +${{inputs.toolchain}} --version)"
|
echo "::set-output name=rustc-version::$(rustc --version)"
|
||||||
rustc +${{inputs.toolchain}} --version --verbose
|
rustc --version --verbose
|
||||||
echo "::set-output name=cargo-version::$(cargo +${{inputs.toolchain}} --version)"
|
echo "::set-output name=cargo-version::$(cargo --version)"
|
||||||
cargo +${{inputs.toolchain}} --version --verbose
|
cargo --version --verbose
|
||||||
echo "::set-output name=rustup-version::$(rustup +${{inputs.toolchain}} --version)"
|
echo "::set-output name=rustup-version::$(rustup --version)"
|
||||||
rustup +${{inputs.toolchain}} --version
|
rustup --version
|
||||||
|
|
||||||
DATE=$(rustc +${{inputs.toolchain}} --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
|
DATE=$(rustc --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
|
||||||
HASH=$(rustc +${{inputs.toolchain}} --version --verbose | sed -ne 's/^commit-hash: //p')
|
HASH=$(rustc --version --verbose | sed -ne 's/^commit-hash: //p')
|
||||||
echo "::set-output name=cachekey::$(echo $DATE$HASH | head -c12)"
|
echo "::set-output name=cachekey::$(echo $DATE$HASH | head -c12)"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue