Enable sparse registry access using the stable configuration

Exclude versions 1.66 and 1.67, which don't support stable sparse registry.
This commit is contained in:
Jonas Bushart 2023-02-13 21:00:11 +01:00
parent 045ad9ff3f
commit 2ee353b897
3 changed files with 26 additions and 7 deletions

View file

@ -78,10 +78,6 @@ runs:
if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
fi
# Enable sparse index after stabilization
# This causes warnings on stable 1.67, e.g., when using "cargo add"
# https://github.com/rust-lang/cargo/pull/11224
# echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
shell: bash
- name: "Install Rust Problem Matcher"
run: echo "::add-matcher::${{ github.action_path }}/rust.json"
@ -123,6 +119,18 @@ runs:
echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT
shell: bash
# Copied from dtolnay/rust-toolchain and adapted
# https://github.com/dtolnay/rust-toolchain/blob/25dc93b901a87e864900a8aec6c12e9aa794c0c3/action.yml#L100-L108
- name: "Enable cargo sparse registry on stable"
run: |
# except on 1.66 and 1.67, on which it is unstable
if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then
if echo "${{steps.versions.outputs.rustc-version}}" | not grep -q '^rustc 1\.6[67]\.'; then
echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
fi
fi
shell: bash
- name: "Setup Rust Caching"
if: inputs.cache == 'true'
uses: Swatinem/rust-cache@v2