Better and more verbose version printing and cachekey version.

This commit is contained in:
Jonas Bushart 2022-07-19 19:00:36 +00:00 committed by GitHub
parent 8ba04cb6f2
commit 29a2385140
2 changed files with 16 additions and 6 deletions

View File

@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* 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>
* Add rustc version output suitable as a cache key.
This is based on <https://github.com/dtolnay/rust-toolchain/pull/20> and <https://github.com/dtolnay/rust-toolchain/pull/17>.
## [1.0.1] - 2022-04-20

View File

@ -33,6 +33,9 @@ outputs:
rustup-version:
description: "Version as reported by `rustup --version`"
value: ${{steps.versions.outputs.rustup-version}}
cachekey:
description: A short hash of the rustc version, appropriate for use as a cache key. "20220627a831"
value: ${{steps.versions.outputs.cachekey}}
runs:
using: composite
@ -60,15 +63,20 @@ runs:
rustup toolchain install ${{inputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
rustup default ${{inputs.toolchain}}
shell: bash
- name: Print installed versions
id: versions
run: |
echo "::set-output name=rustc-version::$(rustc --version)"
rustc --version
echo "::set-output name=cargo-version::$(cargo --version)"
cargo --version
echo "::set-output name=rustup-version::$(rustup --version)"
rustup --version
echo "::set-output name=rustc-version::$(rustc +${{inputs.toolchain}} --version)"
rustc +${{inputs.toolchain}} --version --verbose
echo "::set-output name=cargo-version::$(cargo +${{inputs.toolchain}} --version)"
cargo +${{inputs.toolchain}} --version --verbose
echo "::set-output name=rustup-version::$(rustup +${{inputs.toolchain}} --version)"
rustup +${{inputs.toolchain}} --version
DATE=$(rustc +${{inputs.toolchain}} --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
HASH=$(rustc +${{inputs.toolchain}} --version --verbose | sed -ne 's/^commit-hash: //p')
echo "::set-output name=cachekey::$(echo $DATE$HASH | head -c12)"
shell: bash
- name: "Setup Rust Caching"