Support rustup installation for Windows

This commit is contained in:
Jonatan Männchen 2025-04-23 16:16:31 +02:00
parent 9399c7bb15
commit d9c91b20fd
No known key found for this signature in database
GPG key ID: BA931F466F0D4260

View file

@ -130,13 +130,20 @@ runs:
run: echo "::add-matcher::${{ github.action_path }}/rust.json"
- name: Install rustup, if needed
if: runner.os != 'Windows'
shell: bash
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:-$HOME/.cargo}/bin" >> $GITHUB_PATH
# Resolve the correct CARGO_HOME path depending on OS
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "${CARGO_HOME:-$USERPROFILE/.cargo}/bin" | sed 's|/|\\|g' >> $GITHUB_PATH
else
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
fi
fi
env:
RUNNER_OS: "${{ runner.os }}"
- name: rustup toolchain install ${{inputs.toolchain || 'stable'}}
env: