2019-09-30 12:42:49 +03:00
|
|
|
name: CI
|
2019-09-29 21:47:24 +03:00
|
|
|
|
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
|
2019-09-29 21:47:24 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
name: Check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2020-05-05 14:13:48 +03:00
|
|
|
uses: actions/checkout@v2
|
2019-09-29 21:47:24 +03:00
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Run cargo check
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
name: Clippy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2020-05-05 14:13:48 +03:00
|
|
|
uses: actions/checkout@v2
|
2019-09-29 21:47:24 +03:00
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Install clippy
|
|
|
|
run: rustup component add clippy
|
|
|
|
|
|
|
|
- name: Run cargo clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
|
|
|
args: -- -D warnings
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
name: Rustfmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2020-05-05 14:13:48 +03:00
|
|
|
uses: actions/checkout@v2
|
2019-09-29 21:47:24 +03:00
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Install rustfmt
|
|
|
|
run: rustup component add rustfmt
|
|
|
|
|
|
|
|
- name: Run cargo fmt
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: fmt
|
|
|
|
args: --all -- --check
|
|
|
|
|
|
|
|
test:
|
|
|
|
name: Test Suite
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
postgres:
|
2021-10-12 17:56:45 +03:00
|
|
|
image: postgis/postgis:14-3.1-alpine
|
2019-09-29 21:47:24 +03:00
|
|
|
env:
|
2021-10-12 17:56:45 +03:00
|
|
|
POSTGRES_DB: db
|
2020-12-27 16:35:05 +03:00
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2019-09-29 21:47:24 +03:00
|
|
|
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
|
2020-05-05 14:13:48 +03:00
|
|
|
uses: actions/checkout@v2
|
2019-09-29 21:47:24 +03:00
|
|
|
|
|
|
|
- name: Setup database
|
|
|
|
run: |
|
|
|
|
sudo apt-get install postgresql-client
|
2021-10-12 17:56:45 +03:00
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/TileBBox.sql
|
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/table_source.sql
|
2021-10-21 12:20:33 +03:00
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/table_source_multiple_geom.sql
|
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/function_source.sql
|
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/function_source_query_params.sql
|
2021-10-12 17:56:45 +03:00
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/points1_source.sql
|
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/points2_source.sql
|
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/points3857_source.sql
|
2022-02-13 15:43:52 +03:00
|
|
|
psql -h $POSTGRES_HOST -p $POSTGRES_PORT -U postgres -d db -f tests/fixtures/points_empty_srid_source.sql
|
2019-09-29 21:47:24 +03:00
|
|
|
env:
|
|
|
|
POSTGRES_HOST: localhost
|
|
|
|
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
2020-05-05 14:13:48 +03:00
|
|
|
- name: Run tests
|
2019-09-29 21:47:24 +03:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
2020-05-05 14:13:48 +03:00
|
|
|
args: --all
|
2019-09-29 21:47:24 +03:00
|
|
|
env:
|
2021-10-12 17:56:45 +03:00
|
|
|
DATABASE_URL: postgres://postgres@localhost:${{ job.services.postgres.ports[5432] }}/db
|
2019-09-29 21:47:24 +03:00
|
|
|
|
|
|
|
- name: Run build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
|
|
|
|
- name: Run server
|
2022-02-13 15:43:52 +03:00
|
|
|
run: ./target/debug/martin --watch --default-srid 900913 &
|
2019-09-30 08:43:16 +03:00
|
|
|
env:
|
2021-10-12 17:56:45 +03:00
|
|
|
DATABASE_URL: postgres://postgres@localhost:${{ job.services.postgres.ports[5432] }}/db
|
2019-09-30 08:43:16 +03:00
|
|
|
|
2021-10-12 17:56:45 +03:00
|
|
|
- name: Test server response for table source
|
2019-09-29 21:47:24 +03:00
|
|
|
run: |
|
2022-02-13 15:43:52 +03:00
|
|
|
curl "localhost:3000/index.json" | jq -e
|
2021-04-24 20:19:37 +03:00
|
|
|
curl "localhost:3000/public.table_source/0/0/0.pbf" > table_source.pbf
|
2019-09-29 21:47:24 +03:00
|
|
|
./tests/vtzero-check table_source.pbf
|
2021-10-12 17:56:45 +03:00
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source/6/38/20.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source/12/2476/1280.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source/13/4952/2560.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source/14/9904/5121.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source/20/633856/327787.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source/21/1267712/655574.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
|
|
|
|
- name: Test server response for composite source
|
|
|
|
run: |
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/0/0/0.pbf" > composite_source.pbf
|
2021-04-24 20:19:37 +03:00
|
|
|
./tests/vtzero-check composite_source.pbf
|
2021-10-12 17:56:45 +03:00
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/6/38/20.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/12/2476/1280.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/13/4952/2560.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/14/9904/5121.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/20/633856/327787.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
curl "localhost:3000/public.table_source,public.points1,public.points2/21/1267712/655574.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
|
|
|
./tests/vtzero-show composite_source.pbf
|
|
|
|
|
|
|
|
- name: Test server response for function source
|
|
|
|
run: |
|
|
|
|
curl "localhost:3000/rpc/public.function_source/0/0/0.pbf" > function_source0.pbf
|
|
|
|
./tests/vtzero-check function_source0.pbf
|
|
|
|
./tests/vtzero-show function_source0.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source/6/38/20.pbf" > function_source6.pbf
|
|
|
|
./tests/vtzero-check function_source6.pbf
|
|
|
|
./tests/vtzero-show function_source6.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source/12/2476/1280.pbf" > function_source12.pbf
|
|
|
|
./tests/vtzero-check function_source12.pbf
|
|
|
|
./tests/vtzero-show function_source12.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source/13/4952/2560.pbf" > function_source13.pbf
|
|
|
|
./tests/vtzero-check function_source13.pbf
|
|
|
|
./tests/vtzero-show function_source13.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source/14/9904/5121.pbf" > function_source14.pbf
|
|
|
|
./tests/vtzero-check function_source14.pbf
|
|
|
|
./tests/vtzero-show function_source14.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source/20/633856/327787.pbf" > function_source20.pbf
|
|
|
|
./tests/vtzero-check function_source20.pbf
|
|
|
|
./tests/vtzero-show function_source20.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source/21/1267712/655574.pbf" > function_source21.pbf
|
|
|
|
./tests/vtzero-check function_source21.pbf
|
|
|
|
./tests/vtzero-show function_source21.pbf
|
|
|
|
curl "localhost:3000/rpc/public.function_source_query_params/0/0/0.pbf?token=martin" > function_source_query_params.pbf
|
|
|
|
./tests/vtzero-check function_source_query_params.pbf
|
|
|
|
./tests/vtzero-show function_source_query_params.pbf
|
|
|
|
|
2022-02-13 15:43:52 +03:00
|
|
|
- name: Test server response for table source with different SRID
|
|
|
|
run: |
|
|
|
|
curl "localhost:3000/public.points3857/0/0/0.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
|
|
|
|
- name: Test server response for table source with empty SRID
|
|
|
|
run: |
|
|
|
|
curl "localhost:3000/public.points_empty_srid/0/0/0.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
|
|
|
./tests/vtzero-show table_source.pbf
|
|
|
|
|
2021-10-12 17:56:45 +03:00
|
|
|
- name: Prepare config
|
|
|
|
run: sed -i 's/5432/${{ job.services.postgres.ports[5432] }}/g' ./tests/config.yaml
|
|
|
|
|
|
|
|
- name: Run server with config
|
|
|
|
run: pkill martin && ./target/debug/martin --config ./tests/config.yaml &
|
|
|
|
|
|
|
|
- name: Test server response
|
|
|
|
run: |
|
|
|
|
curl "localhost:3000/index.json" | jq -e
|
|
|
|
curl "localhost:3000/public.table_source/0/0/0.pbf" > table_source.pbf
|
|
|
|
./tests/vtzero-check table_source.pbf
|
2019-09-29 21:47:24 +03:00
|
|
|
./tests/vtzero-show table_source.pbf
|
2021-10-12 17:56:45 +03:00
|
|
|
curl "localhost:3000/public.points1,public.points2/0/0/0.pbf" > composite_source.pbf
|
|
|
|
./tests/vtzero-check composite_source.pbf
|
2021-04-24 20:19:37 +03:00
|
|
|
./tests/vtzero-show composite_source.pbf
|
2021-10-12 17:56:45 +03:00
|
|
|
curl "localhost:3000/rpc/public.function_source/0/0/0.pbf" > function_source.pbf
|
|
|
|
./tests/vtzero-check function_source.pbf
|
2019-09-29 21:47:24 +03:00
|
|
|
./tests/vtzero-show function_source.pbf
|
2021-10-12 17:56:45 +03:00
|
|
|
curl "localhost:3000/rpc/public.function_source_query_params/0/0/0.pbf?token=martin" > function_source_query_params.pbf
|
|
|
|
./tests/vtzero-check function_source_query_params.pbf
|
|
|
|
./tests/vtzero-show function_source_query_params.pbf
|
2019-09-29 21:47:24 +03:00
|
|
|
|
2019-09-30 19:12:00 +03:00
|
|
|
docker:
|
|
|
|
needs: [test]
|
2020-05-05 14:13:48 +03:00
|
|
|
runs-on: ubuntu-latest
|
2019-09-30 19:12:00 +03:00
|
|
|
steps:
|
2020-05-05 14:13:48 +03:00
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-01-16 15:48:39 +03:00
|
|
|
- name: Docker meta
|
|
|
|
id: docker_meta
|
|
|
|
uses: crazy-max/ghaction-docker-meta@v1
|
|
|
|
with:
|
|
|
|
images: urbica/martin
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
2020-05-05 14:13:48 +03:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2021-01-16 15:48:39 +03:00
|
|
|
|
|
|
|
- name: Build and push the Docker image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-04-24 20:19:37 +03:00
|
|
|
push: true
|
2021-01-16 15:48:39 +03:00
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2019-09-30 19:12:00 +03:00
|
|
|
|
2019-09-29 21:47:24 +03:00
|
|
|
release:
|
2020-05-05 14:13:48 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2019-09-29 21:47:24 +03:00
|
|
|
needs: [test]
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
rust: stable
|
2020-05-04 21:21:11 +03:00
|
|
|
target: x86_64-unknown-linux-gnu
|
2019-09-29 21:47:24 +03:00
|
|
|
bin: martin
|
|
|
|
name: martin-Linux-x86_64.tar.gz
|
|
|
|
- os: windows-latest
|
|
|
|
rust: stable
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
bin: martin.exe
|
|
|
|
name: martin-Windows-x86_64.zip
|
|
|
|
- os: macOS-latest
|
|
|
|
rust: stable
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
bin: martin
|
|
|
|
name: martin-Darwin-x86_64.tar.gz
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.rust }}
|
|
|
|
override: true
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Checkout
|
2020-05-05 14:13:48 +03:00
|
|
|
uses: actions/checkout@v2
|
2019-09-29 21:47:24 +03:00
|
|
|
- name: Run build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --target ${{ matrix.target }}
|
|
|
|
- name: Package
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
strip target/${{ matrix.target }}/release/${{ matrix.bin }}
|
|
|
|
cd target/${{ matrix.target }}/release
|
|
|
|
if [[ "${{ matrix.os }}" == "windows-latest" ]]
|
|
|
|
then
|
|
|
|
7z a ../../../${{ matrix.name }} ${{ matrix.bin }}
|
|
|
|
else
|
|
|
|
tar czvf ../../../${{ matrix.name }} ${{ matrix.bin }}
|
|
|
|
fi
|
|
|
|
cd -
|
2019-09-30 16:24:15 +03:00
|
|
|
- name: Generate SHA-256
|
|
|
|
if: matrix.os == 'macOS-latest'
|
|
|
|
run: shasum -a 256 ${{ matrix.name }}
|
2019-09-29 21:47:24 +03:00
|
|
|
- name: Publish
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2019-09-30 12:42:49 +03:00
|
|
|
draft: true
|
2021-10-12 17:56:45 +03:00
|
|
|
files: 'martin*'
|
2019-09-30 13:33:42 +03:00
|
|
|
body_path: CHANGELOG.md
|
2019-09-29 21:47:24 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|