mirror of
https://github.com/actions-rust-lang/setup-rust-toolchain.git
synced 2024-12-26 17:00:34 +01:00
Merge pull request #26 from Twey/allow-overriding-toolchain-file
This commit is contained in:
commit
bb3f6a170e
3 changed files with 17 additions and 12 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
@ -8,14 +7,14 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
install:
|
install:
|
||||||
name: Rust ${{matrix.rust}} ${{matrix.os}}
|
name: Rust ${{matrix.rust || '(toolchain file)'}} ${{matrix.os}}
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
rust: [
|
rust: [
|
||||||
# Test with toolchain file override
|
# Test with toolchain file override
|
||||||
"1.60",
|
"",
|
||||||
# Test that the sparse registry check works.
|
# Test that the sparse registry check works.
|
||||||
# 1.66 and 1.67 don't support stable sparse registry.
|
# 1.66 and 1.67 don't support stable sparse registry.
|
||||||
"1.66",
|
"1.66",
|
||||||
|
@ -41,10 +40,10 @@ jobs:
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
EOF
|
EOF
|
||||||
shell: bash
|
shell: bash
|
||||||
if: matrix.rust == '1.60'
|
if: matrix.rust == ''
|
||||||
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
name: Run actions-rust-lang/setup-rust-toolchain ${{matrix.rust}}
|
name: Run actions-rust-lang/setup-rust-toolchain ${{matrix.rust || 'on toolchain file'}}
|
||||||
id: toolchain
|
id: toolchain
|
||||||
with:
|
with:
|
||||||
toolchain: ${{matrix.rust}}
|
toolchain: ${{matrix.rust}}
|
||||||
|
|
|
@ -42,7 +42,9 @@ 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, its `toolchain` value takes precedence.
|
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 and no `toolchain` value is provided, all items specified in the toolchain file will be installed.
|
||||||
|
If a `toolchain` value is provided, the toolchain file will be ignored.
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
14
action.yml
14
action.yml
|
@ -15,7 +15,6 @@ inputs:
|
||||||
toolchain:
|
toolchain:
|
||||||
description: "Rust toolchain specification -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification"
|
description: "Rust toolchain specification -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification"
|
||||||
required: false
|
required: false
|
||||||
default: "stable"
|
|
||||||
target:
|
target:
|
||||||
description: "Target triple to install for this toolchain"
|
description: "Target triple to install for this toolchain"
|
||||||
required: false
|
required: false
|
||||||
|
@ -112,9 +111,9 @@ runs:
|
||||||
fi
|
fi
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: rustup toolchain install ${{inputs.toolchain}}
|
- name: rustup toolchain install ${{inputs.toolchain || 'stable'}}
|
||||||
run: |
|
run: |
|
||||||
if [[ -f "rust-toolchain" || -f "rust-toolchain.toml" ]]
|
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
|
||||||
then
|
then
|
||||||
# Install the toolchain as specified in the file
|
# Install the toolchain as specified in the file
|
||||||
# Might break at some point: https://github.com/rust-lang/rustup/issues/1397
|
# Might break at some point: https://github.com/rust-lang/rustup/issues/1397
|
||||||
|
@ -126,10 +125,15 @@ runs:
|
||||||
rustup target add ${targets//,/ }
|
rustup target add ${targets//,/ }
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
|
if [[ -z "$toolchain" ]]
|
||||||
rustup default ${{inputs.toolchain}}
|
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 default $toolchain
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
|
toolchain: ${{inputs.toolchain}}
|
||||||
targets: ${{inputs.target}}
|
targets: ${{inputs.target}}
|
||||||
components: ${{inputs.components}}
|
components: ${{inputs.components}}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
Loading…
Reference in a new issue