refactor: enable more clippy rules #150
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| common-quality: | |
| name: Common Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| - uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0 | |
| with: | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| cache-key: warm | |
| tools: typos-cli,cargo-deny,cargo-shear | |
| - name: Check for typos | |
| run: typos | |
| - name: Run cargo-deny | |
| run: cargo deny check | |
| - name: Run cargo-shear | |
| run: cargo shear | |
| # Code quality checks | |
| quality: | |
| name: Quality Checks ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| - uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0 | |
| with: | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| cache-key: warm | |
| components: clippy rustfmt | |
| tools: typos-cli,cargo-deny,cargo-shear | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| - name: Clippy | |
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| # Test on multiple platforms with different Rust versions | |
| test: | |
| name: Test ${{ matrix.os }} ${{ matrix.features != '' && format('({0})', matrix.features) || '' }} | |
| runs-on: ${{ matrix.os }} | |
| needs: quality | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| features: [""] | |
| include: | |
| # MacOS with fsevent | |
| - os: macos-latest | |
| features: "--no-default-features --features macos_fsevent" | |
| # MacOS with kqueue | |
| - os: macos-latest | |
| features: "--no-default-features --features macos_kqueue" | |
| steps: | |
| - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| - uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0 | |
| with: | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| cache-key: warm | |
| - name: Build | |
| run: cargo build --verbose ${{ matrix.features }} | |
| - name: Build examples | |
| run: cargo build --examples --verbose ${{ matrix.features }} | |
| - name: Run tests | |
| run: cargo test --verbose ${{ matrix.features }} | |
| # Android cross-compilation | |
| android: | |
| name: Android | |
| runs-on: ubuntu-latest | |
| needs: quality | |
| steps: | |
| - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| - uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8 | |
| with: | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| cache-key: warm-android | |
| tools: cargo-ndk | |
| - name: Add Rust targets | |
| run: | | |
| rustup target add armv7-linux-androideabi | |
| rustup target add aarch64-linux-android | |
| - name: Build for Android (arm64) | |
| run: cargo ndk --target aarch64-linux-android build --verbose | |
| - name: Build for Android (arm) | |
| run: cargo ndk --target armv7-linux-androideabi build --verbose | |
| # # WebAssembly System Interface (WASI) | |
| # wasi: | |
| # name: WASI | |
| # runs-on: ubuntu-latest | |
| # needs: quality | |
| # steps: | |
| # - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| # - uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8 | |
| # with: | |
| # save-cache: ${{ github.ref_name == 'main' }} | |
| # cache-key: warm-wasi | |
| # - name: Add Rust target | |
| # run: rustup target add wasm32-wasip2 | |
| # - name: Build for WASI | |
| # run: cargo build --target wasm32-wasip2 --verbose | |
| # - name: Build examples for WASI | |
| # run: cargo build --examples --target wasm32-wasip2 --verbose |