name: Rust CI on: push: branches: [main] paths: - '**/*.rs' - '**/Cargo.toml' - '**/Cargo.lock' - '.github/workflows/ci.yaml' pull_request: paths: - '**/*.rs' - '**/Cargo.toml' - '**/Cargo.lock' - '.github/workflows/ci.yaml' env: CARGO_TERM_COLOR: always concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: check: name: Check strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: 0 - uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 with: components: rustfmt, clippy cache-shared-key: setup-rust-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }} - name: Install reviewdog uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0 - name: Check format run: | cargo fmt --all -- --check - uses: giraffate/clippy-action@13b9d32482f25d29ead141b79e7e04e7900281e0 # v1.0.1 with: reporter: 'github-pr-review' github_token: ${{ secrets.GITHUB_TOKEN }} fail_on_error: true filter_mode: nofilter - name: Build run: cargo build test: name: Test strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} permissions: contents: write pull-requests: write steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: 0 - uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 with: components: llvm-tools-preview cache-shared-key: setup-rust-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }} - name: Install tools uses: taiki-e/install-action@30eab0fabba9ea3f522099957e668b21876aa39e # v2.66.6 with: tool: cargo-llvm-cov, cargo-nextest - name: Run test if: runner.os != 'Linux' run: | cargo nextest run - name: Generate coverage if: runner.os == 'Linux' run: cargo llvm-cov nextest --lcov --output-path lcov.info - name: Upload coverage if: runner.os == 'Linux' uses: k1LoW/octocov-action@73d561f65d59e66899ed5c87e4621a913b5d5c20 # v1.5.0 with: github-token: ${{ secrets.GITHUB_TOKEN }}