mirror of
https://github.com/maplibre/martin.git
synced 2024-12-21 05:41:55 +03:00
43 lines
1.5 KiB
YAML
43 lines
1.5 KiB
YAML
name: Rust
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: mdillon/postgis:11-alpine
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_DB: test
|
|
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:
|
|
- uses: actions/checkout@v1
|
|
- name: Build
|
|
run: cargo build --verbose
|
|
- name: Prepare
|
|
run: |
|
|
sudo apt-get install postgresql-client
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d test -f tests/fixtures/TileBBox.sql
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d test -f tests/fixtures/table_source.sql
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d test -f tests/fixtures/function_source.sql
|
|
env:
|
|
# use localhost for the host here because we are running the job on the VM.
|
|
# If we were running the job on in a container this would be postgres
|
|
POSTGRES_HOST: localhost
|
|
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
|
|
- name: Run tests
|
|
run: cargo test --verbose
|
|
env:
|
|
POSTGRES_HOST: localhost
|
|
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
|
|
DATABASE_URL: postgres://postgres@$POSTGRES_HOST:$POSTGRES_PORT/test
|