name: Coverage
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
coverage:
name: coverage (${{ matrix.name }})
timeout-minutes: 20
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
include:
- name: SQLx
cargo_args: --workspace --exclude graphile_worker_admin_ui_client
nextest_args: --test-threads=16
output: cobertura-sqlx.xml
codecov_flags: sqlx
- name: tokio-postgres
cargo_args: --workspace --exclude graphile_worker_admin_ui_client --no-default-features --features driver-tokio-postgres
nextest_args: --test-threads=16
output: cobertura-tokio-postgres.xml
codecov_flags: tokio-postgres
- name: combined drivers
cargo_args: --workspace --exclude graphile_worker_admin_ui_client --features driver-tokio-postgres
nextest_args: --test-threads=16
output: cobertura-combined.xml
codecov_flags: ""
env:
CARGO_INCREMENTAL: 0
DATABASE_URL: postgres://testuser:testpassword@localhost:5432/testdb
COVERAGE_IGNORE_REGEX: "crates/graphile-worker-admin-ui/src/(lib\\.rs|native/.*\\.rs)|crates/graphile-worker-cli/src/main\\.rs"
services:
postgres:
image: postgres:18
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: testdb
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run coverage
run: |
cargo llvm-cov nextest --ignore-filename-regex "${COVERAGE_IGNORE_REGEX}" --cobertura --output-path "${{ matrix.output }}" ${{ matrix.cargo_args }} ${{ matrix.nextest_args }}
- name: Upload combined coverage to Codecov
if: matrix.codecov_flags == ''
uses: codecov/codecov-action@v6
with:
files: ./${{ matrix.output }}
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload flagged coverage to Codecov
if: matrix.codecov_flags != ''
uses: codecov/codecov-action@v6
with:
files: ./${{ matrix.output }}
flags: ${{ matrix.codecov_flags }}
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}