diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 590f34c..ea621ce 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -22,17 +22,22 @@ jobs: - name: Checkout uses: actions/checkout@v5 - - name: Check Rust toolchain is preinstalled + - name: Use preinstalled Rust toolchain run: | - rustup --version - rustup toolchain list - rustup toolchain list | grep -F '1.85.0' >/dev/null || { - echo 'Rust 1.85.0 is not installed in the Gitea runner image.' >&2 - echo 'Install it on the runner image/host before running CI:' >&2 - echo 'rustup toolchain install 1.85.0 --profile minimal --component clippy --component rustfmt' >&2 + set -eu + toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/1.85.0-x86_64-unknown-linux-gnu" + toolchain_bin="$toolchain_dir/bin" + if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then + echo "Rust 1.85.0 is not preinstalled at $toolchain_dir." >&2 + echo "Install it in the Gitea runner image/host before running CI:" >&2 + echo "rustup toolchain install 1.85.0 --profile minimal --component clippy --component rustfmt" >&2 exit 1 - } - rustup component list --toolchain 1.85.0 --installed + fi + printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH" + "$toolchain_bin/rustc" --version + "$toolchain_bin/cargo" --version + "$toolchain_bin/rustfmt" --version + "$toolchain_bin/cargo-clippy" --version - name: Verify runner toolchain run: | @@ -116,17 +121,22 @@ jobs: - name: Checkout uses: actions/checkout@v5 - - name: Check Rust toolchain is preinstalled + - name: Use preinstalled Rust toolchain run: | - rustup --version - rustup toolchain list - rustup toolchain list | grep -F '1.85.0' >/dev/null || { - echo 'Rust 1.85.0 is not installed in the Gitea runner image.' >&2 - echo 'Install it on the runner image/host before running CI:' >&2 - echo 'rustup toolchain install 1.85.0 --profile minimal --component clippy --component rustfmt' >&2 + set -eu + toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/1.85.0-x86_64-unknown-linux-gnu" + toolchain_bin="$toolchain_dir/bin" + if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then + echo "Rust 1.85.0 is not preinstalled at $toolchain_dir." >&2 + echo "Install it in the Gitea runner image/host before running CI:" >&2 + echo "rustup toolchain install 1.85.0 --profile minimal --component clippy --component rustfmt" >&2 exit 1 - } - rustup component list --toolchain 1.85.0 --installed + fi + printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH" + "$toolchain_bin/rustc" --version + "$toolchain_bin/cargo" --version + "$toolchain_bin/rustfmt" --version + "$toolchain_bin/cargo-clippy" --version - name: Verify runner toolchain run: | diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 2e61a89..2a2e1a4 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -22,17 +22,22 @@ jobs: - name: Checkout uses: actions/checkout@v5 - - name: Check Rust toolchain is preinstalled + - name: Use preinstalled Rust toolchain run: | - rustup --version - rustup toolchain list - rustup toolchain list | grep -F '1.85.0' >/dev/null || { - echo 'Rust 1.85.0 is not installed in the Gitea runner image.' >&2 - echo 'Install it on the runner image/host before running CI:' >&2 - echo 'rustup toolchain install 1.85.0 --profile minimal --component clippy --component rustfmt' >&2 + set -eu + toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/1.85.0-x86_64-unknown-linux-gnu" + toolchain_bin="$toolchain_dir/bin" + if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then + echo "Rust 1.85.0 is not preinstalled at $toolchain_dir." >&2 + echo "Install it in the Gitea runner image/host before running CI:" >&2 + echo "rustup toolchain install 1.85.0 --profile minimal --component clippy --component rustfmt" >&2 exit 1 - } - rustup component list --toolchain 1.85.0 --installed + fi + printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH" + "$toolchain_bin/rustc" --version + "$toolchain_bin/cargo" --version + "$toolchain_bin/rustfmt" --version + "$toolchain_bin/cargo-clippy" --version - name: Verify runner toolchain run: |