name: Code Coverage Report.
on:
push:
branches:
- main
- 'feature/**'
- 'fix/**'
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 3
RUSTUP_MAX_RETRIES: 3
TARPAULIN_VERSION: '0.37.5'
jobs:
code_coverage_report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Rust
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
id: toolchain
with:
toolchain: stable
components: llvm-tools-preview
- name: Cache Rust dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-coverage-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-coverage-${{ steps.toolchain.outputs.cachekey }}-
- name: Cache cargo-tarpaulin
id: cache-tarpaulin
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.cargo/bin/cargo-tarpaulin
key: ${{ runner.os }}-tarpaulin-${{ env.TARPAULIN_VERSION }}
- name: Install cargo-tarpaulin
if: steps.cache-tarpaulin.outputs.cache-hit != 'true'
run: cargo install cargo-tarpaulin --version ${{ env.TARPAULIN_VERSION }} --locked
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y make
- name: Generate code coverage report
run: >
cargo tarpaulin --color Always --engine llvm --verbose --tests
--all-targets --all-features --workspace --timeout 600 --out Xml
- name: Upload coverage reports to Codecov.io
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f
with:
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}