mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 12:51:37 +03:00
b8ac719be8
Rework CI to run tests locally using the VM-installed Postgres on all target platforms. ### CI jobs * Build release versions on Linux/Win/Mac and save build results as output artifacts * In a separate VMs (Linux/Win/Mac) * use [nyurik/action-setup-postgis](https://github.com/nyurik/action-setup-postgis) to install postgis and run tests using the built artifacts * run `cargo test` on Linux only * copy built artifacts from the build step, and run tests using the release martin binary * package and publish if this is a release ### Other changes * Port some minor changes from the rewrite to porting easier * minor cleanups * remove all "expected" data files - too unstable to be usable
64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
name: Code coverage
|
|
|
|
jobs:
|
|
grcov:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# PG_* variables are used by psql
|
|
PGDATABASE: test
|
|
PGHOST: localhost
|
|
PGUSER: postgres
|
|
services:
|
|
postgres:
|
|
image: postgis/postgis:14-3.3-alpine
|
|
env:
|
|
# POSTGRES_* variables are used by the postgis/postgres image
|
|
POSTGRES_DB: ${{ env.PGDATABASE }}
|
|
POSTGRES_USER: ${{ env.PGUSER }}
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
ports:
|
|
# will assign a random free host port
|
|
- 5432/tcp
|
|
# needed because the postgres container does not provide a healthcheck
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup database
|
|
run: |
|
|
sudo apt-get install postgresql-client
|
|
tests/fixtures/initdb.sh
|
|
env:
|
|
PGPORT: ${{ job.services.postgres.ports[5432] }}
|
|
|
|
- name: Install nightly toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: nightly
|
|
override: true
|
|
|
|
- name: Run tests
|
|
run: cargo test --all
|
|
env:
|
|
CARGO_INCREMENTAL: '0'
|
|
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
|
|
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}
|
|
|
|
- name: Gather coverage data
|
|
id: coverage
|
|
uses: actions-rs/grcov@v0.1
|
|
|
|
- name: Codecov upload
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ${{ steps.coverage.outputs.report }}
|