mirror of
https://github.com/obi1kenobi/cargo-semver-checks-action.git
synced 2024-11-24 17:09:32 +01:00
Change '' to 'manual' for rust-toolchain input (#41)
* Change '' to 'manual' for rust-toolchain * Default is stable, modify tests
This commit is contained in:
parent
670e9a45ae
commit
7eca687541
5 changed files with 11 additions and 12 deletions
12
.github/workflows/test-inputs.yml
vendored
12
.github/workflows/test-inputs.yml
vendored
|
@ -272,8 +272,8 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test-rust-toolchain-empty:
|
test-rust-toolchain-manual:
|
||||||
name: Test whether action works properly with rust-toolchain set to an empty string
|
name: Test whether action works properly with rust-toolchain set to 'manual'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the test repository
|
- name: Checkout the test repository
|
||||||
|
@ -289,10 +289,10 @@ jobs:
|
||||||
uses: dtolnay/rust-toolchain@beta
|
uses: dtolnay/rust-toolchain@beta
|
||||||
- name: Set local override to beta
|
- name: Set local override to beta
|
||||||
run: rustup override set beta
|
run: rustup override set beta
|
||||||
- name: Run the action with empty rust-toolchain
|
- name: Run the action with manual rust-toolchain
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
with:
|
with:
|
||||||
rust-toolchain: ''
|
rust-toolchain: manual
|
||||||
- name: Get cache key
|
- name: Get cache key
|
||||||
uses: actions/cache/restore@v3
|
uses: actions/cache/restore@v3
|
||||||
id: get-cache-key
|
id: get-cache-key
|
||||||
|
@ -310,11 +310,11 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
- name: Uninstall Rust
|
- name: Uninstall Rust
|
||||||
run: rustup self uninstall -y
|
run: rustup self uninstall -y
|
||||||
- name: Run the action with empty rust-toolchain (allowed to fail)
|
- name: Run the action with manual rust-toolchain (allowed to fail)
|
||||||
id: action_without_rust
|
id: action_without_rust
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
with:
|
with:
|
||||||
rust-toolchain: ''
|
rust-toolchain: manual
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Fail if the action has not returned any errors (but it should have)
|
- name: Fail if the action has not returned any errors (but it should have)
|
||||||
if: steps.action_without_rust.outcome != 'failure'
|
if: steps.action_without_rust.outcome != 'failure'
|
||||||
|
|
|
@ -19,7 +19,7 @@ Every argument is optional.
|
||||||
| `package` | The package whose API to check for semver (in Package Id Specification format, see https://doc.rust-lang.org/cargo/reference/pkgid-spec.html for reference). If not set, all packages defined in the Cargo.toml file are processed. | |
|
| `package` | The package whose API to check for semver (in Package Id Specification format, see https://doc.rust-lang.org/cargo/reference/pkgid-spec.html for reference). If not set, all packages defined in the Cargo.toml file are processed. | |
|
||||||
| `manifest-path` | Path to Cargo.toml of crate or workspace to check. If not specified, the action assumes the manifest is under the default [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) path. | |
|
| `manifest-path` | Path to Cargo.toml of crate or workspace to check. If not specified, the action assumes the manifest is under the default [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) path. | |
|
||||||
| `verbose` | Enables verbose output of `cargo-semver-checks`. | `false` |
|
| `verbose` | Enables verbose output of `cargo-semver-checks`. | `false` |
|
||||||
| `rust-toolchain` | Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to be an empty string, the action assumes some Rust toolchain is already installed and uses the default one. | `stable` |
|
| `rust-toolchain` | Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to `manual`, the action assumes some Rust toolchain is already installed and uses the default one. | `stable` |
|
||||||
| `shared-key` | A cache key that will be used instead of the automatic key based on the name of the GitHub job and values of the inputs `package` and `manifest-path`. Might be provided e.g. to share the cache between the jobs. | |
|
| `shared-key` | A cache key that will be used instead of the automatic key based on the name of the GitHub job and values of the inputs `package` and `manifest-path`. Might be provided e.g. to share the cache between the jobs. | |
|
||||||
| `prefix-key` | Additional prefix of the cache key, can be set to start a new cache manually. | |
|
| `prefix-key` | Additional prefix of the cache key, can be set to start a new cache manually. | |
|
||||||
| `github-token` | The `GITHUB_TOKEN` secret used to download precompiled binaries from GitHub API. If not specified, the [automatic GitHub token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) provided to the workflow will be used. The token may be alternatively passed in an environment variable `GITHUB_TOKEN`. | `${{ github.token }}` |
|
| `github-token` | The `GITHUB_TOKEN` secret used to download precompiled binaries from GitHub API. If not specified, the [automatic GitHub token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) provided to the workflow will be used. The token may be alternatively passed in an environment variable `GITHUB_TOKEN`. | `${{ github.token }}` |
|
||||||
|
|
|
@ -16,8 +16,7 @@ inputs:
|
||||||
required: true
|
required: true
|
||||||
default: false
|
default: false
|
||||||
rust-toolchain:
|
rust-toolchain:
|
||||||
description: 'Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to be an empty string, the action assumes some Rust toolchain is already installed and uses the default one.'
|
description: 'Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to `manual`, the action assumes some Rust toolchain is already installed and uses the default one.'
|
||||||
required: false
|
|
||||||
default: 'stable'
|
default: 'stable'
|
||||||
shared-key:
|
shared-key:
|
||||||
description: 'A cache key that will be used instead of the automatic key based on the name of the GitHub job and values of the inputs `package` and `manifest-path`. Might be provided e.g. to share the cache between the jobs.'
|
description: 'A cache key that will be used instead of the automatic key based on the name of the GitHub job and values of the inputs `package` and `manifest-path`. Might be provided e.g. to share the cache between the jobs.'
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -51,8 +51,8 @@ async function getCargoSemverChecksDownloadURL(target: string): Promise<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
async function installRustUpIfRequested(): Promise<void> {
|
async function installRustUpIfRequested(): Promise<void> {
|
||||||
const toolchain = rustCore.input.getInput("rust-toolchain");
|
const toolchain = rustCore.input.getInput("rust-toolchain") || "stable";
|
||||||
if (toolchain) {
|
if (toolchain != "manual") {
|
||||||
const rustup = await rustCore.RustUp.getOrInstall();
|
const rustup = await rustCore.RustUp.getOrInstall();
|
||||||
await rustup.call(["show"]);
|
await rustup.call(["show"]);
|
||||||
await rustup.setProfile("minimal");
|
await rustup.setProfile("minimal");
|
||||||
|
|
Loading…
Reference in a new issue