From 8cd4dbf592bf6ec52535db8c0a513bf96e8b3cf3 Mon Sep 17 00:00:00 2001 From: voson Date: Fri, 20 Mar 2026 21:54:13 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=9B=BA=E5=AE=9A=20Rust=201.94.0?= =?UTF-8?q?=EF=BC=88rust-toolchain=20+=20Gitea=20Actions=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- .gitea/workflows/secrets.yml | 32 ++++++++++++++++++++++---------- rust-toolchain.toml | 3 +++ 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.gitea/workflows/secrets.yml b/.gitea/workflows/secrets.yml index b47f364..0e57179 100644 --- a/.gitea/workflows/secrets.yml +++ b/.gitea/workflows/secrets.yml @@ -19,6 +19,7 @@ permissions: env: MCP_BINARY: secrets-mcp + RUST_TOOLCHAIN: 1.94.0 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 CARGO_TERM_COLOR: always @@ -144,12 +145,15 @@ jobs: steps: - name: 安装 Rust run: | - if ! command -v cargo >/dev/null 2>&1; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable + if ! command -v rustup >/dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "${RUST_TOOLCHAIN}" echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" fi source "$HOME/.cargo/env" 2>/dev/null || true - rustup component add rustfmt clippy + rustup toolchain install "${RUST_TOOLCHAIN}" --profile minimal --component rustfmt --component clippy + rustup default "${RUST_TOOLCHAIN}" + rustc -V + cargo -V - uses: actions/checkout@v4 @@ -179,12 +183,16 @@ jobs: run: | sudo apt-get update sudo apt-get install -y pkg-config musl-tools binutils curl - if ! command -v cargo >/dev/null 2>&1; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable + if ! command -v rustup >/dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "${RUST_TOOLCHAIN}" + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" fi source "$HOME/.cargo/env" 2>/dev/null || true - rustup target add x86_64-unknown-linux-musl - echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + rustup toolchain install "${RUST_TOOLCHAIN}" --profile minimal + rustup default "${RUST_TOOLCHAIN}" + rustup target add x86_64-unknown-linux-musl --toolchain "${RUST_TOOLCHAIN}" + rustc -V + cargo -V - uses: actions/checkout@v4 @@ -258,13 +266,17 @@ jobs: - name: 安装 Rust run: | - if ! command -v cargo >/dev/null 2>&1; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable + if ! command -v rustup >/dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "${RUST_TOOLCHAIN}" echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" fi source "$HOME/.cargo/env" 2>/dev/null || true sudo apt-get update -qq && sudo apt-get install -y -qq pkg-config musl-tools - rustup target add x86_64-unknown-linux-musl + rustup toolchain install "${RUST_TOOLCHAIN}" --profile minimal + rustup default "${RUST_TOOLCHAIN}" + rustup target add x86_64-unknown-linux-musl --toolchain "${RUST_TOOLCHAIN}" + rustc -V + cargo -V - name: 缓存 Cargo uses: actions/cache@v4 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..0d8ed42 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.94.0" +components = ["rustfmt", "clippy"]