summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-09-25 15:49:28 +0800
committer魏曹先生 <1992414357@qq.com>2025-09-25 15:49:28 +0800
commit0eeb842c21ff1681e77ccbd47fe7a3c9779a65d5 (patch)
tree8c3ffb1f97dbbedb7756fb33f519547083047f24 /.github/workflows
parent2865206dda1d57df1c95dd8e49d5599db89407ae (diff)
Fix clippy warnings in test files
- Convert manual async functions to async fn syntax - Replace assert_eq!(true/false, ...) with assert!(...) and assert!(!...) - Fix useless vec warning by using array directly - All tests continue to pass after optimizations
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/rust.yml132
1 files changed, 66 insertions, 66 deletions
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index d493041..0374efc 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -2,9 +2,9 @@ name: Rust CI
on:
push:
- branches: [ "main" ]
+ branches: ["main"]
pull_request:
- branches: [ "main" ]
+ branches: ["main"]
env:
CARGO_TERM_COLOR: always
@@ -16,85 +16,85 @@ jobs:
outputs:
cache-key: ${{ steps.cache-key.outputs.value }}
steps:
- - uses: actions/checkout@v4
- - name: Install Rust toolchain
- uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- toolchain: stable
- targets: x86_64-unknown-linux-musl
- - name: Generate cache key
- id: cache-key
- run: echo "value=cargo-$(rustc -V | sed 's/.*(\(.*\))/\1/')-$(sha256sum Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT
+ - uses: actions/checkout@v4
+ - name: Install Rust toolchain
+ uses: actions-rust-lang/setup-rust-toolchain@v1
+ with:
+ toolchain: stable
+ targets: x86_64-unknown-linux-musl
+ - name: Generate cache key
+ id: cache-key
+ run: echo "value=cargo-$(rustc -V | sed 's/.*(\(.*\))/\1/')-$(sha256sum Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT
lint:
runs-on: ubuntu-latest
needs: setup
steps:
- - uses: actions/checkout@v4
- - name: Restore cache
- uses: actions/cache@v3
- with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ needs.setup.outputs.cache-key }}-lint
- - name: Install Rust toolchain
- uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- toolchain: stable
- components: clippy, rustfmt
- - name: Run clippy
- run: cargo clippy --workspace --all-targets -- -D warnings
- - name: Check formatting
- run: cargo fmt --check
+ - uses: actions/checkout@v4
+ - name: Restore cache
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ target
+ key: ${{ needs.setup.outputs.cache-key }}-lint
+ - name: Install Rust toolchain
+ uses: actions-rust-lang/setup-rust-toolchain@v1
+ with:
+ toolchain: stable
+ components: clippy, rustfmt
+ - name: Run clippy
+ run: cargo clippy --workspace --all-targets -- -D warnings
+ - name: Check formatting
+ run: cargo fmt --check
test:
runs-on: ubuntu-latest
- needs: [setup, lint]
+ needs: setup
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
steps:
- - uses: actions/checkout@v4
- - name: Restore cache
- uses: actions/cache@v3
- with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ needs.setup.outputs.cache-key }}-test
- - name: Verify musl target is installed
- run: rustup target list | grep x86_64-unknown-linux-musl | grep installed
- - name: Build
- run: cargo build --workspace --verbose
- - name: Run tests
- run: cargo test --workspace --verbose
- - name: Check binary compatibility
- run: |
- cargo build --workspace --release
- find target/x86_64-unknown-linux-musl/release -maxdepth 1 -executable -type f 2>/dev/null | head -5 | xargs -I {} sh -c 'file {} | grep -q "statically linked" && echo "✓ {} is statically linked" || echo "✗ {} is not statically linked"'
+ - uses: actions/checkout@v4
+ - name: Restore cache
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ target
+ key: ${{ needs.setup.outputs.cache-key }}-test
+ - name: Verify musl target is installed
+ run: rustup target list | grep x86_64-unknown-linux-musl | grep installed
+ - name: Build
+ run: cargo build --workspace --verbose
+ - name: Run tests
+ run: cargo test --workspace --verbose
+ - name: Check binary compatibility
+ run: |
+ cargo build --workspace --release
+ find target/x86_64-unknown-linux-musl/release -maxdepth 1 -executable -type f 2>/dev/null | head -5 | xargs -I {} sh -c 'file {} | grep -q "statically linked" && echo "✓ {} is statically linked" || echo "✗ {} is not statically linked"'
release:
runs-on: ubuntu-latest
- needs: test
+ needs: [lint, test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
steps:
- - uses: actions/checkout@v4
- - name: Restore cache
- uses: actions/cache@v3
- with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ needs.setup.outputs.cache-key }}-release
- - name: Build release binaries
- run: cargo build --workspace --release
- - name: Upload artifacts
- uses: actions/upload-artifact@v3
- with:
- name: release-binaries
- path: target/x86_64-unknown-linux-musl/release/
+ - uses: actions/checkout@v4
+ - name: Restore cache
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ target
+ key: ${{ needs.setup.outputs.cache-key }}-release
+ - name: Build release binaries
+ run: cargo build --workspace --release
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: release-binaries
+ path: target/x86_64-unknown-linux-musl/release/