From 388482c6202b991b04cbf0c7c525ac0f1b228b20 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Fri, 30 Oct 2026 02:46:16 +0100 Subject: [PATCH] ci(rust): fixes and optimizations - removes cargo check since the clippy step builds already - image switched to rust:alpine - less correctness during build for speedier compilation --- .gitea/workflows/rust.yml | 40 +++++++++------------------------------ 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/.gitea/workflows/rust.yml b/.gitea/workflows/rust.yml index a1e9e38..4c84f7e 100644 --- a/.gitea/workflows/rust.yml +++ b/.gitea/workflows/rust.yml @@ -3,11 +3,10 @@ name: Rust on: pull_request: -# jobs can be separated if we integrate tests jobs: - build, clippy & fmt: + clippy & fmt: runs-on: alpine - container: node:26-alpine + container: rust:alpine env: CARGO_HOME: ${{ github.workspace }}/.cargo @@ -17,48 +16,26 @@ jobs: - name: Cache cargo packages uses: actions/cache@v4 - env: - cache-name: cache-cargo-packages with: path: | .cargo/registry .cargo/git target - key: rust-build-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} + key: rust-build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - rust-${{ runner.os }}-build-${{ env.cache-name }}- - rust-${{ runner.os }}-build- - rust- + rust-${{ runner.os }}-cargo- - name: Install tools run: | - apk add --no-cache \ - git \ - cargo \ - rust \ - rust-clippy \ - rustfmt + apk add --no-cache git + rustup component add clippy rustfmt - - name: Cargo check - run: | - if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then - for manifest in $(find . -name "Cargo.toml"); do - cargo check --manifest-path "$manifest" && \ - echo "$manifest: check passed" || \ - { echo "$manifest: check failed"; exit 1; } - done - elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then - echo "Rust files found but no Cargo.toml" - exit 1 - else - echo "No Rust project found" - fi - - name: Clippy + - name: Clippy (with compile check) run: | if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then status=0 for manifest in $(find . -name "Cargo.toml"); do - cargo clippy --manifest-path "$manifest" --all-targets --all-features -- -D warnings && \ + cargo clippy --manifest-path "$manifest" -- -D warnings && \ echo "$manifest: Clippy passed" || \ { echo "$manifest: Clippy failed"; status=1; } done @@ -69,6 +46,7 @@ jobs: else echo "No Rust project found" fi + - name: Format check run: | if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then