2020-05-05 14:13:48 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-11-07 17:28:21 +03:00
|
|
|
- main
|
2020-05-05 14:13:48 +03:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-11-07 17:28:21 +03:00
|
|
|
- main
|
2020-05-05 14:13:48 +03:00
|
|
|
|
|
|
|
name: Code coverage
|
|
|
|
|
|
|
|
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-10-26 12:52:31 +03:00
|
|
|
run: cargo test --all
|
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 }}
|