mirror of
https://github.com/actions-rs/toolchain.git
synced 2024-11-14 05:26:34 +02:00
Release v1.0.5
This commit is contained in:
parent
402d025565
commit
23cd1093e2
8 changed files with 82 additions and 17 deletions
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
|
@ -17,12 +17,30 @@ jobs:
|
||||||
- run: npm run test
|
- run: npm run test
|
||||||
|
|
||||||
install_stable:
|
install_stable:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macOS-latest
|
||||||
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: ./
|
- id: toolchain
|
||||||
|
uses: ./
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
- name: Test toolchain outputs
|
||||||
|
env:
|
||||||
|
RUSTC: ${{ steps.toolchain.outputs.rustc }}
|
||||||
|
RUSTC_HASH: ${{ steps.toolchain.outputs.rustc_hash }}
|
||||||
|
CARGO: ${{ steps.toolchain.outputs.cargo }}
|
||||||
|
RUSTUP: ${{ steps.toolchain.outputs.rustup }}
|
||||||
|
run: |
|
||||||
|
echo $RUSTC
|
||||||
|
echo $RUSTC_HASH
|
||||||
|
echo $CARGO
|
||||||
|
echo $RUSTUP
|
||||||
|
|
||||||
install_nightly:
|
install_nightly:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.0.5] - 2020-01-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `rustup` version parser does not fail Action execution on `macOS-latest` VM images anymore
|
||||||
|
|
||||||
## [1.0.4] - 2020-01-26
|
## [1.0.4] - 2020-01-26
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -58,7 +58,7 @@ Installed `rustc`, `cargo` and `rustup` versions can be fetched from the Action
|
||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
| ------------ | --------------------- | ------------------------------- |
|
| ------------ | --------------------- | ------------------------------- |
|
||||||
| `rustc` | Rustc version | `1.40.0 (73528e339 2019-12-16)` |
|
| `rustc` | Rustc version | `1.40.0 (73528e339 2019-12-16)` |
|
||||||
| `rustc-hash` | Rustc version hash | `73528e339` |
|
| `rustc_hash` | Rustc version hash | `73528e339` |
|
||||||
| `cargo` | Cargo version | `1.40.0 (bc8e4c8be 2019-11-22)` |
|
| `cargo` | Cargo version | `1.40.0 (bc8e4c8be 2019-11-22)` |
|
||||||
| `rustup` | rustup version | `1.21.1 (7832b2ebe 2019-12-20)` |
|
| `rustup` | rustup version | `1.21.1 (7832b2ebe 2019-12-20)` |
|
||||||
|
|
||||||
|
|
10
action.yml
10
action.yml
|
@ -29,6 +29,16 @@ inputs:
|
||||||
description: Comma-separated list of components to be additionally installed for a new toolchain
|
description: Comma-separated list of components to be additionally installed for a new toolchain
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
rustc:
|
||||||
|
description: Installed Rustc version
|
||||||
|
rustc_hash:
|
||||||
|
description: Installed Rustc version hash, can be used for caching purposes
|
||||||
|
cargo:
|
||||||
|
description: Installed Cargo version
|
||||||
|
rustup:
|
||||||
|
description: Installed rustup version
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "rust-toolchain",
|
"name": "rust-toolchain",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "rust-toolchain",
|
"name": "rust-toolchain",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Install the Rust toolchain",
|
"description": "Install the Rust toolchain",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
|
|
@ -18,10 +18,15 @@ export async function gatherInstalledVersions(): Promise<void> {
|
||||||
*/
|
*/
|
||||||
async function rustc(): Promise<void> {
|
async function rustc(): Promise<void> {
|
||||||
const stdout = await getStdout('rustc', ['-V']);
|
const stdout = await getStdout('rustc', ['-V']);
|
||||||
const version = parse(stdout);
|
try {
|
||||||
|
const version = parseFull(stdout);
|
||||||
|
|
||||||
core.setOutput('rustc', version.long);
|
core.setOutput('rustc', version.long);
|
||||||
core.setOutput('rustc-hash', version.hash);
|
core.setOutput('rustc_hash', version.hash);
|
||||||
|
} catch(e) {
|
||||||
|
core.warning(e);
|
||||||
|
core.setOutput('rustc', parseShort(stdout));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,18 +34,23 @@ async function rustc(): Promise<void> {
|
||||||
*/
|
*/
|
||||||
async function cargo(): Promise<void> {
|
async function cargo(): Promise<void> {
|
||||||
const stdout = await getStdout('cargo', ['-V']);
|
const stdout = await getStdout('cargo', ['-V']);
|
||||||
const version = parse(stdout);
|
try {
|
||||||
|
const version = parseFull(stdout);
|
||||||
|
|
||||||
core.setOutput('cargo', version.long);
|
core.setOutput('cargo', version.long);
|
||||||
// core.setOutput('cargo_short', version.short);
|
} catch(e) {
|
||||||
|
core.setOutput('cargo', parseShort(stdout));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function rustup(): Promise<void> {
|
async function rustup(): Promise<void> {
|
||||||
const stdout = await getStdout('rustup', ['-V']);
|
const stdout = await getStdout('rustup', ['-V']);
|
||||||
const version = parse(stdout);
|
try {
|
||||||
|
const version = parseFull(stdout);
|
||||||
core.setOutput('rustup', version.long);
|
core.setOutput('rustup', version.long);
|
||||||
// core.setOutput('rustup_short', version.short);
|
} catch(e) {
|
||||||
|
core.setOutput('rustup', parseShort(stdout));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Version {
|
interface Version {
|
||||||
|
@ -48,7 +58,17 @@ interface Version {
|
||||||
hash: string,
|
hash: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse(stdout: string): Version {
|
/**
|
||||||
|
* Try to parse the version parts and return them.
|
||||||
|
*
|
||||||
|
* It is important to note that some components are not providing
|
||||||
|
* all the expected information, ex. `rustup` on `macOS-latest` VM image
|
||||||
|
* does not has the hash in the version string,
|
||||||
|
* so this function might throw an error.
|
||||||
|
*
|
||||||
|
* As a fallback, `parseShort` function can be used.
|
||||||
|
*/
|
||||||
|
function parseFull(stdout: string): Version {
|
||||||
stdout = stdout.trim();
|
stdout = stdout.trim();
|
||||||
const matches = stdout.match(/\S+\s((\S+)\s\((\S+)\s(\S+)\))/m);
|
const matches = stdout.match(/\S+\s((\S+)\s\((\S+)\s(\S+)\))/m);
|
||||||
if (matches == null) {
|
if (matches == null) {
|
||||||
|
@ -61,6 +81,17 @@ function parse(stdout: string): Version {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseShort(stdout: string): string {
|
||||||
|
stdout = stdout.trim();
|
||||||
|
const matches = stdout.match(/\S+\s(.+)/m);
|
||||||
|
if (matches == null) {
|
||||||
|
core.warning(`Unable to determine version from the "${stdout}" string`);
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return matches[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function getStdout(exe: string, args: string[], options?: {}): Promise<string> {
|
async function getStdout(exe: string, args: string[], options?: {}): Promise<string> {
|
||||||
let stdout = '';
|
let stdout = '';
|
||||||
const resOptions = Object.assign({}, options, {
|
const resOptions = Object.assign({}, options, {
|
||||||
|
|
Loading…
Reference in a new issue