name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable]
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-tarpaulin
uses: actions-rs/install@v0.1
with:
crate: cargo-tarpaulin
version: latest
use-tool-cache: true
- name: Generate coverage report
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --out Xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
fail_ci_if_error: false