This commit is contained in:
chenwj113 2024-08-21 16:29:44 +08:00
parent 5b4ddd6a3e
commit 672094484c
1 changed files with 35 additions and 0 deletions

View File

@ -112,6 +112,41 @@ runs:
if [[ ! -v RUSTUP_UPDATE_ROOT ]]; then if [[ ! -v RUSTUP_UPDATE_ROOT ]]; then
echo "RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup" >> $GITHUB_ENV echo "RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup" >> $GITHUB_ENV
fi fi
if [[ ! -f ~/.cargo/config ]]; then
mkdir -p ~/.cargo
cat > ~/.cargo/config <<EOF
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
EOF
fi
- name: Install Rust toolchain
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://rsproxy.cn/rustup-init.exe" -o rustup-init.exe
powershell -Command .\rustup-init.exe -y
fi
- name: Cache Rust toolchain
uses: actions/cache@v3
env:
cache_key: ${{ runner.os }}-rustup-${{ runner.arch }}-${{ runner.temp }}-${{ hashFiles('**/rust-toolchain', '**/rust-toolchain.toml') }}
with:
path: ${{ runner.temp }}/cargo-home
- name: Install Rust Problem Matcher - name: Install Rust Problem Matcher
if: inputs.matcher == 'true' if: inputs.matcher == 'true'