From e229b3478b56dd41c016dbcf594ad6740a088852 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 30 Apr 2026 13:48:00 +0800 Subject: [PATCH] ci: modernize GitHub Actions workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update actions/checkout@v2 → v4 - Replace actions-rs/toolchain@v1 with dtolnay/rust-toolchain@stable - Replace actions-rs/cargo@v1 with direct cargo commands - Replace actions-rs/audit-check@v1 with rustsec/audit-check@v2 - Add pull_request trigger to check.yml - Add push/pull_request triggers to audit.yml on Cargo file changes - Add Swatinem/rust-cache@v2 for faster builds - Add clippy lint job (cargo clippy --all-targets --all-features -- -D warnings) - Add format check job (cargo fmt --all -- --check) The deprecated actions-rs/* actions are no longer maintained and use outdated Node.js runtimes. This brings the CI configuration up to date with current best practices while preserving all existing functionality. --- .github/workflows/audit.yml | 12 ++++++++-- .github/workflows/check.yml | 47 +++++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 8fd84584..7af9a8cc 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,12 +1,20 @@ name: Security audit on: + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + pull_request: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' schedule: - cron: '0 0 * * *' jobs: audit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/audit-check@v1 + - uses: actions/checkout@v4 + - uses: rustsec/audit-check@v2.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8dd1abb9..041965cd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,19 +1,18 @@ name: Checks -on: [push] +on: + push: + branches: [master] + pull_request: + branches: [master] jobs: check: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: check + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo check test: name: Test Suite runs-on: ubuntu-latest @@ -21,12 +20,26 @@ jobs: - uses: szenius/set-timezone@v1.0 with: timezoneLinux: Europe/Berlin - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo test + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 + components: clippy + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy --all-targets --all-features -- -D warnings + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: - command: test \ No newline at end of file + components: rustfmt + - run: cargo fmt --all -- --check