Merge pull request #13 from actions-rust-lang/double-run

This commit is contained in:
Jonas Bushart 2023-02-21 22:23:42 +01:00 committed by GitHub
commit 64fef3b541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.4.3] - 2023-02-21
### Fixed
* Executing the action twice for different toolchains now no longer fails around unstable features #12.
If multiple toolchains are installed, the "CARGO_REGISTRIES_CRATES_IO_PROTOCOL" can be downgraded to "git" if any of the installed toolchains require it.
## [1.4.2] - 2023-02-15 ## [1.4.2] - 2023-02-15
### Fixed ### Fixed

View File

@ -85,6 +85,9 @@ runs:
if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
fi fi
if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then
echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
fi
shell: bash shell: bash
- 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"
@ -126,17 +129,15 @@ runs:
echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT
shell: bash shell: bash
# Copied from dtolnay/rust-toolchain and adapted - name: "Downgrade registry access protocol when needed"
# https://github.com/dtolnay/rust-toolchain/blob/25dc93b901a87e864900a8aec6c12e9aa794c0c3/action.yml#L100-L108
- name: "Enable cargo sparse registry on stable"
run: | run: |
# except on 1.66 and 1.67, on which it is unstable # Not all versions support setting CARGO_REGISTRIES_CRATES_IO_PROTOCOL
# Not all 1.68.0-nightly versions support it either # On versions 1.66, 1.67, and 1.68.0-nightly the value "sparse" is still unstable.
# https://github.com/dtolnay/rust-toolchain/pull/69#discussion_r1107268108 # https://github.com/dtolnay/rust-toolchain/pull/69#discussion_r1107268108
if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then # If we detect an incompatible value, set it to "git" which is always supported.
if echo "${{steps.versions.outputs.rustc-version}}" | grep --invert --quiet '^rustc \(1\.6[67]\.\|1\.68\.0-nightly\)'; then if [[ "${{steps.versions.outputs.rustc-version}}" =~ ^rustc\ (1\.6[67]\.|1\.68\.0-nightly) && "${CARGO_REGISTRIES_CRATES_IO_PROTOCOL}" == "sparse" ]]; then
echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV echo "Downgrade cargo registry protocol to git"
fi echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=git" >> $GITHUB_ENV
fi fi
shell: bash shell: bash