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: DATABASE_URL: postgres://postgres@localhost:${{ job.services.postgres.ports[5432] }}/test - name: Run server in background run: ./target/debug/martin & env: DATABASE_URL: postgres://postgres@localhost:${{ job.services.postgres.ports[5432] }}/test - name: Test server tile responses run: | curl localhost:3000/public.table_source/0/0/0.pbf > table_source.pbf curl localhost:3000/rpc/public.function_source/0/0/0.pbf > function_source.pbf ./tests/vtzero-check table_source.pbf ./tests/vtzero-check function_source.pbf ./tests/vtzero-show table_source.pbf ./tests/vtzero-show function_source.pbf