name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
components: clippy, rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-targets --all-features
- name: Install tools
uses: taiki-e/install-action@fd2f5e3d644b484055ebf4268f474c565f148f25 with:
tool: cargo-audit,cargo-tarpaulin
- name: Run cargo-audit
run: cargo audit
- name: Run cargo-tarpaulin
run: cargo tarpaulin --out Xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f with:
token: ${{ secrets.CODECOV_TOKEN }}
files: cobertura.xml
fail_ci_if_error: true