5 Commits

3 changed files with 54 additions and 7 deletions

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

View File

@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.1.0] - 2022-07-19
### 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>
* 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>.
### Changed
* Update to `Swatinem/rust-cache@v2`.
## [1.0.2] - 2022-05-02
### Changed
* Enable colored cargo output.
* Print short backtraces during test failure.
## [1.0.1] - 2022-04-20 ## [1.0.1] - 2022-04-20
### Added ### Added

View File

@ -33,6 +33,9 @@ outputs:
rustup-version: rustup-version:
description: "Version as reported by `rustup --version`" description: "Version as reported by `rustup --version`"
value: ${{steps.versions.outputs.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: runs:
using: composite using: composite
@ -47,24 +50,37 @@ 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
rustup default ${{inputs.toolchain}} rustup default ${{inputs.toolchain}}
shell: bash shell: bash
- name: Print installed versions - name: Print installed versions
id: versions id: versions
run: | run: |
echo "::set-output name=rustc-version::$(rustc --version)" echo "::set-output name=rustc-version::$(rustc +${{inputs.toolchain}} --version)"
rustc --version rustc +${{inputs.toolchain}} --version --verbose
echo "::set-output name=cargo-version::$(cargo --version)" echo "::set-output name=cargo-version::$(cargo +${{inputs.toolchain}} --version)"
cargo --version cargo +${{inputs.toolchain}} --version --verbose
echo "::set-output name=rustup-version::$(rustup --version)" echo "::set-output name=rustup-version::$(rustup +${{inputs.toolchain}} --version)"
rustup --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 shell: bash
- name: "Setup Rust Caching" - name: "Setup Rust Caching"
uses: Swatinem/rust-cache@v1 uses: Swatinem/rust-cache@v2
- name: "Install Rust Problem Matcher" - name: "Install Rust Problem Matcher"
run: echo "::add-matcher::${{ github.action_path }}/rust.json" run: echo "::add-matcher::${{ github.action_path }}/rust.json"
shell: bash shell: bash