Support toml rust-toolchain & working-directory

Closes #126
This commit is contained in:
Boaz Berman 2021-04-05 19:12:59 +03:00
parent 88dc235639
commit 00a8bf2bdc
21 changed files with 231 additions and 138 deletions

View file

@ -14,14 +14,14 @@ these small papercuts for you.
**Table of Contents**
* [Example workflow](#example-workflow)
* [Inputs](#inputs)
* [Outputs](#outputs)
* [Profiles](#profiles)
* [Components](#components)
* [The toolchain file](#the-toolchain-file)
* [License](#license)
* [Contribute and support](#contribute-and-support)
- [Example workflow](#example-workflow)
- [Inputs](#inputs)
- [Outputs](#outputs)
- [Profiles](#profiles)
- [Components](#components)
- [The toolchain file](#the-toolchain-file)
- [License](#license)
- [Contribute and support](#contribute-and-support)
## Example workflow
@ -31,25 +31,25 @@ on: [push]
name: build
jobs:
check:
name: Rust project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
check:
name: Rust project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
# `cargo check` command here will use installed `nightly`
# as it is set as an "override" for current directory
# `cargo check` command here will use installed `nightly`
# as it is set as an "override" for current directory
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
```
See [additional recipes here](https://github.com/actions-rs/meta).
@ -57,7 +57,7 @@ See [additional recipes here](https://github.com/actions-rs/meta).
## Inputs
| Name | Required | Description | Type | Default |
| ------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------| ------ | --------|
| ------------ | :------: | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------- |
| `toolchain` | | [Toolchain](https://github.com/rust-lang/rustup.rs#toolchain-specification) name to use, ex. `stable`, `nightly`, `nightly-2019-04-20`, or `1.32.0` | string | stable |
| `target` | | Additionally install specified target for this toolchain, ex. `x86_64-apple-darwin` | string | |
| `default` | | Set installed toolchain as a default toolchain | bool | false |
@ -72,12 +72,12 @@ in order to support toolchain files. See the details [below](#the-toolchain-file
Installed `rustc`, `cargo` and `rustup` versions can be fetched from the Action outputs:
| Name | Description | Example |
| ------------ | --------------------- | ------------------------------- |
| `rustc` | Rustc version | `1.40.0 (73528e339 2019-12-16)` |
| `rustc_hash` | Rustc version hash | `73528e339` |
| `cargo` | Cargo version | `1.40.0 (bc8e4c8be 2019-11-22)` |
| `rustup` | rustup version | `1.21.1 (7832b2ebe 2019-12-20)` |
| Name | Description | Example |
| ------------ | ------------------ | ------------------------------- |
| `rustc` | Rustc version | `1.40.0 (73528e339 2019-12-16)` |
| `rustc_hash` | Rustc version hash | `73528e339` |
| `cargo` | Cargo version | `1.40.0 (bc8e4c8be 2019-11-22)` |
| `rustup` | rustup version | `1.21.1 (7832b2ebe 2019-12-20)` |
Note: `rustc_hash` output value can be used with [actions/cache](https://github.com/actions/cache) Action
to store cache for different Rust versions, as it is unique across different Rust versions and builds (including `nightly`).
@ -92,8 +92,8 @@ minimally required set of components, for example:
- name: Install minimal nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
profile: minimal
toolchain: nightly
```
This Action will automatically run `rustup self update` if `profile` input is set
@ -114,9 +114,9 @@ and in combination with the [profiles](#profiles) input it allows to install onl
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
profile: minimal
toolchain: stable
components: rustfmt, clippy
```
As an extra perk, `rustup >= 1.20.0` is able to find the most recent `nightly` toolchain
@ -127,9 +127,9 @@ to install the minimal set of `nightly` toolchain components with the `rustfmt`
- name: Install minimal nightly with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt, clippy
profile: minimal
toolchain: nightly
components: rustfmt, clippy
```
In case if `nightly` toolchain is requested and one of the components is missing in
@ -137,8 +137,8 @@ latest `nightly` release, this Action will attempt the downgrade till it find
the most recent `nightly` with all components needed.\
Note that this behavior will work only if the following two conditions apply:
1. `toolchain` input is `nightly` exactly.
2. At least one component is provided in `components` input.
1. `toolchain` input is `nightly` exactly.
2. At least one component is provided in `components` input.
Same to the `profile` input, if installed `rustup` does not supports "components",
it will be automatically upgraded by this Action.