name: CI
permissions:
contents: read
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- name: Setup rust toolchain
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 with:
channel: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- name: Setup rust toolchain
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 with:
channel: stable
components: clippy
- name: Run clippy
run: cargo clippy --all-features --all-targets --locked -- -D warnings
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- name: Setup rust toolchain
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 with:
channel: stable
cache-target: test
bins: cargo-nextest
- name: Run tests
run: cargo nextest run --all-features
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@76cd80eb775d7bbbd2d80292136d74d39e1b4918 coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- name: Setup rust toolchain, cache, install nextest and cargo-llvm-cov
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 with:
channel: nightly
components: llvm-tools
cache-target: test
bins: cargo-nextest,cargo-llvm-cov
- name: Generate coverage
run: |
cargo +nightly llvm-cov --all-features --no-report nextest
cargo +nightly llvm-cov --all-features --no-report --doc
cargo +nightly llvm-cov report --doctests --lcov --output-path lcov.info
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f with:
file: target/nextest/default/junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 with:
files: lcov.info
fail_ci_if_error: false