2022-11-02 21:00:05 +03:00
|
|
|
name: Code coverage
|
|
|
|
|
2020-05-05 14:13:48 +03:00
|
|
|
on:
|
|
|
|
push:
|
2022-12-14 00:20:52 +03:00
|
|
|
branches: [main, v0.6]
|
2023-03-28 19:36:44 +03:00
|
|
|
paths-ignore: ['**.md']
|
2020-05-05 14:13:48 +03:00
|
|
|
pull_request:
|
2022-12-14 00:20:52 +03:00
|
|
|
branches: [main, v0.6]
|
2023-03-28 19:36:44 +03:00
|
|
|
paths-ignore: ['**.md']
|
2022-10-31 23:28:21 +03:00
|
|
|
workflow_dispatch:
|
2020-05-05 14:13:48 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
grcov:
|
|
|
|
runs-on: ubuntu-latest
|
2022-10-28 21:52:39 +03:00
|
|
|
env:
|
|
|
|
# PG_* variables are used by psql
|
|
|
|
PGDATABASE: test
|
|
|
|
PGHOST: localhost
|
|
|
|
PGUSER: postgres
|
2020-05-05 14:13:48 +03:00
|
|
|
services:
|
|
|
|
postgres:
|
2022-10-28 21:52:39 +03:00
|
|
|
image: postgis/postgis:14-3.3-alpine
|
2020-05-05 14:13:48 +03:00
|
|
|
env:
|
2022-10-28 21:52:39 +03:00
|
|
|
# POSTGRES_* variables are used by the postgis/postgres image
|
|
|
|
POSTGRES_DB: ${{ env.PGDATABASE }}
|
|
|
|
POSTGRES_USER: ${{ env.PGUSER }}
|
2020-12-27 16:35:05 +03:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2020-05-05 14:13:48 +03:00
|
|
|
ports:
|
2022-10-28 21:52:39 +03:00
|
|
|
# will assign a random free host port
|
2020-05-05 14:13:48 +03:00
|
|
|
- 5432/tcp
|
2022-10-28 21:52:39 +03:00
|
|
|
# needed because the postgres container does not provide a healthcheck
|
2020-05-05 14:13:48 +03:00
|
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2022-05-27 15:00:45 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-05-05 14:13:48 +03:00
|
|
|
|
|
|
|
- name: Setup database
|
|
|
|
run: |
|
|
|
|
sudo apt-get install postgresql-client
|
2022-10-28 21:52:39 +03:00
|
|
|
tests/fixtures/initdb.sh
|
2020-05-05 14:13:48 +03:00
|
|
|
env:
|
2022-10-28 21:52:39 +03:00
|
|
|
PGPORT: ${{ job.services.postgres.ports[5432] }}
|
2020-05-05 14:13:48 +03:00
|
|
|
|
|
|
|
- name: Install nightly toolchain
|
2022-10-26 12:52:31 +03:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2020-05-05 14:13:48 +03:00
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Run tests
|
2022-11-19 17:50:27 +03:00
|
|
|
run: cargo test
|
2020-05-05 14:13:48 +03:00
|
|
|
env:
|
2022-05-27 14:46:48 +03:00
|
|
|
CARGO_INCREMENTAL: '0'
|
2020-05-05 14:13:48 +03:00
|
|
|
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
|
2022-05-27 14:46:48 +03:00
|
|
|
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
|
2022-10-28 21:52:39 +03:00
|
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}
|
2020-05-05 14:13:48 +03:00
|
|
|
|
|
|
|
- name: Gather coverage data
|
|
|
|
id: coverage
|
|
|
|
uses: actions-rs/grcov@v0.1
|
|
|
|
|
|
|
|
- name: Codecov upload
|
2022-05-27 15:00:32 +03:00
|
|
|
uses: codecov/codecov-action@v3
|
2020-05-05 14:13:48 +03:00
|
|
|
with:
|
|
|
|
file: ${{ steps.coverage.outputs.report }}
|
2023-04-03 05:06:55 +03:00
|
|
|
|
|
|
|
- name: Check conditional cfg values
|
|
|
|
run: |
|
|
|
|
cargo +nightly check -Z unstable-options -Z check-cfg=features,names,values,output --workspace --all-features
|
|
|
|
env:
|
|
|
|
RUSTFLAGS: '-D warnings'
|