👷 Use Tarpaulin for coverage (#4) #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
branches: | |
- main | |
- master | |
- develop | |
push: | |
branches: | |
- main | |
- master | |
- develop | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
coverage: | |
name: Test Coverage | |
runs-on: ubuntu-latest | |
container: | |
image: xd009642/tarpaulin | |
options: --security-opt seccomp=unconfined | |
strategy: | |
matrix: | |
flags: | |
- lib | |
- doc | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
# - run: cargo install tarpaulin | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: tarpaulin | |
args: --${{ matrix.flags }} --all-features --workspace --out xml | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v1 | |
with: | |
name: code-coverage-report | |
path: cobertura.xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
if: "!contains(github.event.head_commit.message, '[skip codecov]')" | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: cobertura.xml | |
flags: ${{ matrix.flags }} | |
fail_ci_if_error: true | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- run: rustup component add clippy | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D warnings |