Install rustup if not available, Linux only

The original code stems from this PR:
https://github.com/dtolnay/rust-toolchain/pull/8
This commit is contained in:
Jonas Bushart 2022-07-19 18:48:19 +00:00 committed by GitHub
parent 5c0654516c
commit 8ba04cb6f2
2 changed files with 13 additions and 0 deletions

View File

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
* Install rustup if not available in the CI environment. (Linux only)
The code is taken from this issue: <https://github.com/dtolnay/rust-toolchain/pull/8>
## [1.0.1] - 2022-04-20 ## [1.0.1] - 2022-04-20
### Added ### Added

View File

@ -47,6 +47,14 @@ runs:
targets: ${{inputs.target}} targets: ${{inputs.target}}
components: ${{inputs.components}} components: ${{inputs.components}}
shell: bash shell: bash
- name: Install rustup, if needed
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:-~/.cargo}/bin" >> $GITHUB_PATH
fi
if: runner.os != 'Windows'
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 rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update