name: PR Check
on:
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Check formatting (info)
run: cargo fmt --check || echo "::warning::Run 'cargo fmt' to fix formatting"
continue-on-error: true
- name: Run clippy (info)
run: cargo clippy || echo "::warning::Clippy found issues"
continue-on-error: true
- name: Run tests (required)
run: cargo test --verbose
- name: Install tarpaulin
uses: taiki-e/install-action@v2
with:
tool: cargo-tarpaulin
- name: Generate coverage report
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
cross-platform:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ matrix.os }}
- name: Run tests
run: cargo test --verbose