Skip to content

CI: Replace tarpaulin with native source-based coverage #15

CI: Replace tarpaulin with native source-based coverage

CI: Replace tarpaulin with native source-based coverage #15

Workflow file for this run

name: Coverage
on:
push:
branches:
- coverage
- main
- master
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Test Coverage
runs-on: ubuntu-22.04
env:
RUST_BACKTRACE: 1
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
RUSTFLAGS: "-D warnings -Cinstrument-coverage"
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"
services:
postgres:
image: postgres:13@sha256:eee22204934b36935237e7c92355e3178cfdf3c5377dec9c19c848115cc4637b
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- run: cargo test --workspace
- run: rustup component add llvm-tools
- run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" --ignore "target/debug/build/**" -o target/coverage/tests.lcov
- uses: codecov/codecov-action@v3.1.4
with:
files: target/coverage/tests.lcov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}