name: CI
on:
pull_request:
push:
branches: [ main ]
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt, clippy, rust-docs
- name: ⚡ Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo
restore-keys: ${{ runner.os }}-cargo
- name: ✔ Check
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --tests --all-features
- name: ☕ Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: 🌝 Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --tests --all-features
- name: 🔎 Unit and integration tests
uses: actions-rs/cargo@v1
with:
command: test
- name: 📘 Run cargo docs
uses: actions-rs/cargo@v1
with:
command: doc
args: --lib --no-deps
code_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: 🔨Code coverage
uses: actions-rs/tarpaulin@v0.1
- name: ⮕ Upload to codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}