11 Commits

4 changed files with 72 additions and 13 deletions

View File

@ -19,7 +19,7 @@ jobs:
- name: Get version from tag - name: Get version from tag
id: tag_name id: tag_name
run: | run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/} echo "current_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
shell: bash shell: bash
- name: Create and push tags - name: Create and push tags
run: | run: |

View File

@ -7,6 +7,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.3.3] - 2022-10-13
### Changed
* Switch from set-output to $GITHUB_OUTPUT to avoid warning
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
## [1.3.2] - 2022-09-15
### Fixed
* Fix setting `$CARGO_HOME` to a valid path, in case rustup is installed from the internet.
Thanks to @nahsi for providing the fix.
## [1.3.1] - 2022-08-14
### Changed
* Use the sparse-registry on nightly for faster access to the crate registry on nightly.
<https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862>
## [1.3.0] - 2022-07-30
### Added
* An option to disable configuring Rust cache.
Thanks to @filips123 for the PR.
## [1.2.1] - 2022-07-29
### Fixed
* Set environment variables before invoking the cache action.
This ensures restoring and saving are using the same cache key.
## [1.2.0] - 2022-07-21 ## [1.2.0] - 2022-07-21
### Added ### Added

View File

@ -24,6 +24,19 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --all-features - run: cargo test --all-features
# Check formatting with rustfmt
formatting:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
``` ```
## Inputs ## Inputs
@ -37,6 +50,7 @@ All input values are ignored if a toolchain file exists.
| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable | | `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable |
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | | | `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | | | `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
| `cache` | Automatically configure Rust cache (using `Swatinem/rust-cache`) | true |
## Outputs ## Outputs

View File

@ -22,6 +22,10 @@ inputs:
components: components:
description: "Comma-separated list of components to be additionally installed" description: "Comma-separated list of components to be additionally installed"
required: false required: false
cache:
description: "Automatically configure Rust cache"
required: false
default: "true"
outputs: outputs:
rustc-version: rustc-version:
@ -50,11 +54,27 @@ runs:
targets: ${{inputs.target}} targets: ${{inputs.target}}
components: ${{inputs.components}} components: ${{inputs.components}}
shell: bash shell: bash
# The environment variables always need to be set before the caching action
- name: "Setting Environment Variables"
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
echo "RUST_BACKTRACE=short" >> $GITHUB_ENV
echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV
# Enable faster sparse index on nightly
# https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862
echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
shell: bash
- name: "Install Rust Problem Matcher"
run: echo "::add-matcher::${{ github.action_path }}/rust.json"
shell: bash
- name: Install rustup, if needed - name: Install rustup, if needed
run: | run: |
if ! command -v rustup &> /dev/null ; then 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 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 echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
fi fi
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: bash shell: bash
@ -87,15 +107,5 @@ runs:
shell: bash shell: bash
- name: "Setup Rust Caching" - name: "Setup Rust Caching"
if: inputs.cache == 'true'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: "Install Rust Problem Matcher"
run: echo "::add-matcher::${{ github.action_path }}/rust.json"
shell: bash
- name: "Setting Environment Variables"
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
echo "RUST_BACKTRACE=short" >> $GITHUB_ENV
echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV
shell: bash