mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 12:51:37 +03:00
a42ea5c0ae
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 5. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/peter-evans/create-pull-request/releases">peter-evans/create-pull-request's releases</a>.</em></p> <blockquote> <h2>Create Pull Request v5.0.0</h2> <h2>Behaviour changes</h2> <ul> <li>The action will no longer leave the local repository checked out on the pull request <code>branch</code>. Instead, it will leave the repository checked out on the branch or commit that it was when the action started.</li> <li>When using <code>add-paths</code>, uncommitted changes will no longer be destroyed. They will be stashed and restored at the end of the action run.</li> </ul> <h2>What's new</h2> <ul> <li>Adds input <code>body-path</code>, the path to a file containing the pull request body.</li> <li>At the end of the action run the local repository is now checked out on the branch or commit that it was when the action started.</li> <li>Any uncommitted tracked or untracked changes are now stashed and restored at the end of the action run. Currently, this can only occur when using the <code>add-paths</code> input, which allows for changes to not be committed. Previously, any uncommitted changes would be destroyed.</li> <li>The proxy implementation has been revised but is not expected to have any change in behaviour. It continues to support the standard environment variables <code>http_proxy</code>, <code>https_proxy</code> and <code>no_proxy</code>.</li> <li>Now sets the git <code>safe.directory</code> configuration for the local repository path. The configuration is removed when the action completes. Fixes issue <a href="https://redirect.github.com/peter-evans/create-pull-request/issues/1170">peter-evans/create-pull-request#1170</a>.</li> <li>Now determines the git directory path using the <code>git rev-parse --git-dir</code> command. This allows users with custom repository configurations to use the action.</li> <li>Improved handling of the <code>team-reviewers</code> input and associated errors.</li> </ul> <h2>News</h2> <p>🏆 create-pull-request won <a href="https://twitter.com/peterevans0/status/1638463617686470657?s=20">an award</a> for "awesome action" at the Open Source Awards at GitHub Universe. Thank you for your support and for making create-pull-request one of the top used actions. Please give it a ⭐, or even <a href="https://github.com/sponsors/peter-evans">buy me a coffee</a>.</p> <h2>What's Changed</h2> <ul> <li>v5 by <a href="https://github.com/peter-evans"><code>@peter-evans</code></a> in <a href="https://redirect.github.com/peter-evans/create-pull-request/pull/1792">peter-evans/create-pull-request#1792</a></li> <li>15 dependency updates by <a href="https://github.com/dependabot"><code>@dependabot</code></a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/peter-evans/create-pull-request/compare/v4.2.4...v5.0.0">https://github.com/peter-evans/create-pull-request/compare/v4.2.4...v5.0.0</a></p> <h2>Create Pull Request v4.2.4</h2> <p>⚙️ Patches some recent security vulnerabilities.</p> <h2>What's Changed</h2> <ul> <li>Update concepts-guidelines.md by <a href="https://github.com/chrisbruford"><code>@chrisbruford</code></a> in <a href="https://redirect.github.com/peter-evans/create-pull-request/pull/1610">peter-evans/create-pull-request#1610</a></li> <li>58 dependency updates by <a href="https://github.com/dependabot"><code>@dependabot</code></a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/chrisbruford"><code>@chrisbruford</code></a> made their first contribution in <a href="https://redirect.github.com/peter-evans/create-pull-request/pull/1610">peter-evans/create-pull-request#1610</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/peter-evans/create-pull-request/compare/v4.2.3...v4.2.4">https://github.com/peter-evans/create-pull-request/compare/v4.2.3...v4.2.4</a></p> <h2>Create Pull Request v4.2.3</h2> <h2>What's Changed</h2> <ul> <li>fix: add check for missing token input by <a href="https://github.com/peter-evans"><code>@peter-evans</code></a> in <a href="https://redirect.github.com/peter-evans/create-pull-request/pull/1324">peter-evans/create-pull-request#1324</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/peter-evans/create-pull-request/compare/v4.2.2...v4.2.3">https://github.com/peter-evans/create-pull-request/compare/v4.2.2...v4.2.3</a></p> <h2>Create Pull Request v4.2.2</h2> <h2>What's Changed</h2> <ul> <li>fix: support github server url for pushing to fork by <a href="https://github.com/peter-evans"><code>@peter-evans</code></a> in <a href="https://redirect.github.com/peter-evans/create-pull-request/pull/1318">peter-evans/create-pull-request#1318</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="153407881e
"><code>1534078</code></a> fix: specify head repo (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2044">#2044</a>)</li> <li><a href="143be5d671
"><code>143be5d</code></a> build(deps-dev): bump <code>@typescript-eslint/parser</code> from 5.59.9 to 5.59.11 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2048">#2048</a>)</li> <li><a href="51e8ca2340
"><code>51e8ca2</code></a> build(deps-dev): bump <code>@types/node</code> from 18.16.16 to 18.16.18 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2047">#2047</a>)</li> <li><a href="712add83f2
"><code>712add8</code></a> build(deps-dev): bump <code>@types/jest</code> from 29.5.1 to 29.5.2 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2026">#2026</a>)</li> <li><a href="a9e8aabc8b
"><code>a9e8aab</code></a> build(deps-dev): bump eslint from 8.41.0 to 8.42.0 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2024">#2024</a>)</li> <li><a href="37be4ffd94
"><code>37be4ff</code></a> build(deps-dev): bump <code>@typescript-eslint/parser</code> from 5.59.8 to 5.59.9 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2023">#2023</a>)</li> <li><a href="a5f0e5dc8e
"><code>a5f0e5d</code></a> build(deps-dev): bump eslint-plugin-github from 4.7.0 to 4.8.0 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2025">#2025</a>)</li> <li><a href="9ef70ee495
"><code>9ef70ee</code></a> build(deps-dev): bump <code>@types/node</code> from 18.16.14 to 18.16.16 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2009">#2009</a>)</li> <li><a href="0a287739d3
"><code>0a28773</code></a> build(deps-dev): bump <code>@typescript-eslint/parser</code> from 5.59.7 to 5.59.8 (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/2008">#2008</a>)</li> <li><a href="4ddb8c8fe7
"><code>4ddb8c8</code></a> build: update distribution (<a href="https://redirect.github.com/peter-evans/create-pull-request/issues/1986">#1986</a>)</li> <li>Additional commits viewable in <a href="https://github.com/peter-evans/create-pull-request/compare/v3...v5">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=peter-evans/create-pull-request&package-manager=github_actions&previous-version=3&new-version=5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
670 lines
25 KiB
YAML
670 lines
25 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'demo/**'
|
|
- 'docs/**'
|
|
release:
|
|
types: [ published ]
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
lint-debug-test:
|
|
name: Lint and Unit test
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
PGDATABASE: test
|
|
PGHOST: localhost
|
|
PGUSER: postgres
|
|
PGPASSWORD: postgres
|
|
services:
|
|
postgres:
|
|
image: postgis/postgis:16-3.4
|
|
ports:
|
|
# will assign a random free host port
|
|
- 5432/tcp
|
|
# Sadly there is currently no way to pass arguments to the service image other than this hack
|
|
# See also https://stackoverflow.com/a/62720566/177275
|
|
options: >-
|
|
-e POSTGRES_DB=test
|
|
-e POSTGRES_USER=postgres
|
|
-e POSTGRES_PASSWORD=postgres
|
|
-e PGDATABASE=test
|
|
-e PGUSER=postgres
|
|
-e PGPASSWORD=postgres
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
--entrypoint sh
|
|
postgis/postgis:16-3.4
|
|
-c "exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key"
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- name: Rust Versions
|
|
run: rustc --version && cargo --version
|
|
- uses: Swatinem/rust-cache@v2
|
|
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
- run: cargo fmt --all -- --check
|
|
- run: cargo clippy --package martin-tile-utils -- -D warnings
|
|
- run: cargo clippy --package martin-mbtiles --no-default-features -- -D warnings
|
|
- run: cargo clippy --package martin-mbtiles -- -D warnings
|
|
- run: cargo clippy --package martin -- -D warnings
|
|
- run: cargo clippy --package martin --features bless-tests -- -D warnings
|
|
- run: cargo doc --no-deps --workspace
|
|
env:
|
|
RUSTDOCFLAGS: "-D warnings"
|
|
- name: Init database
|
|
run: tests/fixtures/initdb.sh
|
|
env:
|
|
PGPORT: ${{ job.services.postgres.ports[5432] }}
|
|
- name: Run cargo test
|
|
run: |
|
|
set -x
|
|
cargo test --package martin-tile-utils
|
|
cargo test --package martin-mbtiles --no-default-features
|
|
cargo test --package martin-mbtiles
|
|
cargo test --package martin
|
|
cargo test --doc
|
|
env:
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=require
|
|
|
|
docker-build-test:
|
|
name: Build and test docker images
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# PG_* variables are used by psql
|
|
PGDATABASE: test
|
|
PGHOST: localhost
|
|
PGUSER: postgres
|
|
PGPASSWORD: postgres
|
|
TARGETS: "aarch64-unknown-linux-musl x86_64-unknown-linux-musl"
|
|
# TODO: aarch64-unknown-linux-gnu
|
|
services:
|
|
postgres:
|
|
image: postgis/postgis:15-3.3
|
|
ports:
|
|
- 5432/tcp
|
|
options: >-
|
|
-e POSTGRES_DB=test
|
|
-e POSTGRES_USER=postgres
|
|
-e POSTGRES_PASSWORD=postgres
|
|
-e PGDATABASE=test
|
|
-e PGUSER=postgres
|
|
-e PGPASSWORD=postgres
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
--entrypoint sh
|
|
postgis/postgis:15-3.3
|
|
-c "exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key"
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- uses: Swatinem/rust-cache@v2
|
|
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
- name: Install cross
|
|
run: |
|
|
cargo install cross
|
|
# Install latest cross version from git (disabled as it is probably less stable)
|
|
# cargo install cross --git https://github.com/cross-rs/cross
|
|
cross --version
|
|
- name: Init database
|
|
run: tests/fixtures/initdb.sh
|
|
env:
|
|
PGPORT: ${{ job.services.postgres.ports[5432] }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
# https://github.com/docker/setup-qemu-action
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
# https://github.com/docker/setup-buildx-action
|
|
with:
|
|
install: true
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Build targets
|
|
run: |
|
|
for target in $TARGETS; do
|
|
echo -e "\n----------------------------------------------"
|
|
echo "Building $target"
|
|
|
|
export "CARGO_TARGET_$(echo $target | tr 'a-z-' 'A-Z_')_RUSTFLAGS"='-C strip=debuginfo'
|
|
cross build --release --target $target --package martin-mbtiles
|
|
cross build --release --target $target --package martin
|
|
|
|
mkdir -p target_releases/$target
|
|
mv target/$target/release/mbtiles target_releases/$target
|
|
mv target/$target/release/martin target_releases/$target
|
|
done
|
|
|
|
- name: Save build artifacts to build-${{ matrix.target }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: cross-build
|
|
path: target_releases/*
|
|
- name: Reorganize artifacts for docker build
|
|
run: |
|
|
mkdir -p target_releases/linux/arm64
|
|
mv target_releases/aarch64-unknown-linux-musl/* target_releases/linux/arm64/
|
|
mkdir -p target_releases/linux/amd64
|
|
mv target_releases/x86_64-unknown-linux-musl/* target_releases/linux/amd64/
|
|
|
|
- name: Build linux/arm64 Docker image
|
|
uses: docker/build-push-action@v5
|
|
# https://github.com/docker/build-push-action
|
|
with:
|
|
context: .
|
|
file: multi-platform.Dockerfile
|
|
load: true
|
|
tags: ${{ github.repository }}:linux-arm64
|
|
platforms: linux/arm64
|
|
- name: Test linux/arm64 Docker image
|
|
run: |
|
|
PLATFORM=linux/arm64
|
|
TAG=${{ github.repository }}:linux-arm64
|
|
export MBTILES_BUILD=-
|
|
export MBTILES_BIN="docker run --rm --net host --platform $PLATFORM -e DATABASE_URL -v $PWD/tests:/tests --entrypoint /usr/local/bin/mbtiles $TAG"
|
|
export MARTIN_BUILD=-
|
|
export MARTIN_BIN="docker run --rm --net host --platform $PLATFORM -e DATABASE_URL -v $PWD/tests:/tests $TAG"
|
|
tests/test.sh
|
|
env:
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=require
|
|
|
|
- name: Build linux/amd64 Docker image
|
|
uses: docker/build-push-action@v5
|
|
# https://github.com/docker/build-push-action
|
|
with:
|
|
context: .
|
|
file: multi-platform.Dockerfile
|
|
load: true
|
|
tags: ${{ github.repository }}:linux-amd64
|
|
platforms: linux/amd64
|
|
- name: Test linux/amd64 Docker image
|
|
run: |
|
|
PLATFORM=linux/amd64
|
|
TAG=${{ github.repository }}:linux-amd64
|
|
export MBTILES_BUILD=-
|
|
export MBTILES_BIN="docker run --rm --net host --platform $PLATFORM -e DATABASE_URL -v $PWD/tests:/tests --entrypoint /usr/local/bin/mbtiles $TAG"
|
|
export MARTIN_BUILD=-
|
|
export MARTIN_BIN="docker run --rm --net host --platform $PLATFORM -e DATABASE_URL -v $PWD/tests:/tests $TAG"
|
|
tests/test.sh
|
|
env:
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=require
|
|
|
|
- name: Login to GitHub Docker registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
# https://github.com/docker/login-action
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v5
|
|
# https://github.com/docker/metadata-action
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- name: Push the Docker image
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: multi-platform.Dockerfile
|
|
push: true
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
build:
|
|
name: Build ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
include:
|
|
- target: aarch64-apple-darwin
|
|
os: macOS-latest
|
|
cross: 'true'
|
|
- target: debian-x86_64
|
|
os: ubuntu-latest
|
|
cross: 'true'
|
|
- target: x86_64-apple-darwin
|
|
os: macOS-latest
|
|
- target: x86_64-pc-windows-msvc
|
|
os: windows-latest
|
|
ext: '.exe'
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- name: Rust Versions
|
|
run: rustc --version && cargo --version
|
|
- uses: Swatinem/rust-cache@v2
|
|
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
- name: Build (.deb)
|
|
if: matrix.target == 'debian-x86_64'
|
|
run: |
|
|
set -x
|
|
sudo apt-get install -y dpkg dpkg-dev liblzma-dev
|
|
cargo install cargo-deb
|
|
cargo deb -v -p martin --output target/debian/debian-x86_64.deb
|
|
mkdir -p target_releases
|
|
mv target/debian/debian-x86_64.deb target_releases/
|
|
- name: Build
|
|
if: matrix.target != 'debian-x86_64'
|
|
run: |
|
|
set -x
|
|
rustup target add "${{ matrix.target }}"
|
|
export RUSTFLAGS='-C strip=debuginfo'
|
|
cargo build --release --target ${{ matrix.target }} --package martin-mbtiles
|
|
cargo build --release --target ${{ matrix.target }} --package martin
|
|
mkdir -p target_releases
|
|
mv target/${{ matrix.target }}/release/mbtiles${{ matrix.ext }} target_releases/
|
|
mv target/${{ matrix.target }}/release/martin${{ matrix.ext }} target_releases/
|
|
- name: Save build artifacts to build-${{ matrix.target }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-${{ matrix.target }}
|
|
path: target_releases/*
|
|
|
|
test-multi-os:
|
|
name: Test on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [ build ]
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
include:
|
|
- target: x86_64-apple-darwin
|
|
os: macOS-latest
|
|
- target: x86_64-pc-windows-msvc
|
|
os: windows-latest
|
|
ext: '.exe'
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- uses: Swatinem/rust-cache@v2
|
|
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
- name: Start postgres
|
|
uses: nyurik/action-setup-postgis@v1
|
|
id: pg
|
|
with:
|
|
username: test
|
|
password: test
|
|
database: test
|
|
rights: --superuser
|
|
- name: Init database
|
|
run: |
|
|
echo "DATABASE_URL=$DATABASE_URL"
|
|
echo "Print the same in base64 to bypass Github's obfuscation (uses hardcoded password):"
|
|
echo "$DATABASE_URL" | base64
|
|
tests/fixtures/initdb.sh
|
|
env:
|
|
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
|
|
- name: Download build artifact build-${{ matrix.target }}
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-${{ matrix.target }}
|
|
path: target/
|
|
- name: Integration Tests
|
|
run: |
|
|
export MARTIN_BUILD=-
|
|
export MARTIN_BIN=target/martin${{ matrix.ext }}
|
|
export MBTILES_BUILD=-
|
|
export MBTILES_BIN=target/mbtiles${{ matrix.ext }}
|
|
if [[ "${{ runner.os }}" != "Windows" ]]; then
|
|
chmod +x "$MARTIN_BIN" "$MBTILES_BIN"
|
|
fi
|
|
tests/test.sh
|
|
env:
|
|
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
|
|
- name: Compare test output results (Linux)
|
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
run: diff --brief --recursive --new-file tests/output tests/expected
|
|
- name: Download Debian package (Linux)
|
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-debian-x86_64
|
|
path: target/
|
|
- name: Tests Debian package (Linux)
|
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
run: |
|
|
sudo dpkg -i target/debian-x86_64.deb
|
|
export MARTIN_BUILD=-
|
|
export MARTIN_BIN=/usr/bin/martin${{ matrix.ext }}
|
|
export MBTILES_BUILD=-
|
|
export MBTILES_BIN=/usr/bin/mbtiles${{ matrix.ext }}
|
|
tests/test.sh
|
|
env:
|
|
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
|
|
- name: Save test output on failure (Linux)
|
|
if: failure() && matrix.target == 'x86_64-unknown-linux-gnu'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: failed-test-output
|
|
path: tests/output/*
|
|
retention-days: 5
|
|
|
|
test-with-svc:
|
|
name: Test postgis:${{ matrix.img_ver }} sslmode=${{ matrix.sslmode }}
|
|
runs-on: ubuntu-latest
|
|
needs: [ build ]
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
include:
|
|
# These must match the versions of postgres used in the docker-compose.yml
|
|
- img_ver: 11-3.0-alpine
|
|
args: postgres
|
|
sslmode: disable
|
|
- img_ver: 14-3.3-alpine
|
|
args: postgres
|
|
sslmode: disable
|
|
# alpine images don't support SSL, so for this we use the debian images
|
|
- img_ver: 15-3.3
|
|
args: postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
|
sslmode: require
|
|
#
|
|
# FIXME!
|
|
# DISABLED because Rustls fails to validate name (CN?) with the NotValidForName error
|
|
#- img_ver: 15-3.3
|
|
# args: postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
|
# sslmode: verify-ca
|
|
#- img_ver: 15-3.3
|
|
# args: postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
|
# sslmode: verify-full
|
|
env:
|
|
PGDATABASE: test
|
|
PGHOST: localhost
|
|
PGUSER: postgres
|
|
PGPASSWORD: postgres
|
|
services:
|
|
postgres:
|
|
image: postgis/postgis:${{ matrix.img_ver }}
|
|
ports:
|
|
- 5432/tcp
|
|
options: >-
|
|
-e POSTGRES_DB=test
|
|
-e POSTGRES_USER=postgres
|
|
-e POSTGRES_PASSWORD=postgres
|
|
-e PGDATABASE=test
|
|
-e PGUSER=postgres
|
|
-e PGPASSWORD=postgres
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
--entrypoint sh
|
|
postgis/postgis:${{ matrix.img_ver }}
|
|
-c "exec docker-entrypoint.sh ${{ matrix.args }}"
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- uses: Swatinem/rust-cache@v2
|
|
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
- name: Init database
|
|
run: tests/fixtures/initdb.sh
|
|
env:
|
|
PGPORT: ${{ job.services.postgres.ports[5432] }}
|
|
- name: Get DB SSL cert (sslmode=verify-*)
|
|
if: matrix.sslmode == 'verify-ca' || matrix.sslmode == 'verify-full'
|
|
run: |
|
|
set -x
|
|
mkdir -p target/certs
|
|
docker cp ${{ job.services.postgres.id }}:/etc/ssl/certs/ssl-cert-snakeoil.pem target/certs/server.crt
|
|
docker cp ${{ job.services.postgres.id }}:/etc/ssl/private/ssl-cert-snakeoil.key target/certs/server.key
|
|
- name: Download build artifact build-x86_64-unknown-linux-gnu
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-x86_64-unknown-linux-gnu
|
|
path: target_releases/
|
|
- name: Integration Tests
|
|
run: |
|
|
if [[ "${{ matrix.sslmode }}" == "verify-ca" || "${{ matrix.sslmode }}" == "verify-full" ]]; then
|
|
export PGSSLROOTCERT=target/certs/server.crt
|
|
fi
|
|
export MARTIN_BUILD=-
|
|
export MARTIN_BIN=target_releases/martin
|
|
export MBTILES_BUILD=-
|
|
export MBTILES_BIN=target_releases/mbtiles
|
|
chmod +x "$MARTIN_BIN" "$MBTILES_BIN"
|
|
tests/test.sh
|
|
rm -rf target_releases
|
|
env:
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
|
|
- name: Download Debian package
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-debian-x86_64
|
|
path: target_releases/
|
|
- name: Tests Debian package
|
|
run: |
|
|
sudo dpkg -i target_releases/debian-x86_64.deb
|
|
if [[ "${{ matrix.sslmode }}" == "verify-ca" || "${{ matrix.sslmode }}" == "verify-full" ]]; then
|
|
export PGSSLROOTCERT=target/certs/server.crt
|
|
fi
|
|
export MARTIN_BUILD=-
|
|
export MARTIN_BIN=/usr/bin/martin
|
|
export MBTILES_BUILD=-
|
|
export MBTILES_BIN=/usr/bin/mbtiles
|
|
tests/test.sh
|
|
sudo dpkg -P martin
|
|
rm -rf target_releases
|
|
env:
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
|
|
- name: Unit Tests
|
|
if: matrix.sslmode != 'verify-ca' && matrix.sslmode != 'verify-full'
|
|
run: |
|
|
echo "Running unit tests, connecting to DATABASE_URL=$DATABASE_URL"
|
|
echo "Same but as base64 to prevent GitHub obfuscation (this is not a secret):"
|
|
echo "$DATABASE_URL" | base64
|
|
set -x
|
|
cargo test --package martin
|
|
cargo clean
|
|
env:
|
|
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
|
|
- name: On error, save test output
|
|
if: failure()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-output
|
|
path: tests/output/*
|
|
retention-days: 5
|
|
|
|
package:
|
|
name: Package
|
|
runs-on: ubuntu-latest
|
|
needs: [ lint-debug-test, docker-build-test, test-multi-os, test-with-svc ]
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- name: Download build artifact build-aarch64-apple-darwin
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-aarch64-apple-darwin
|
|
path: target/aarch64-apple-darwin
|
|
- name: Download build artifact build-x86_64-apple-darwin
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-x86_64-apple-darwin
|
|
path: target/x86_64-apple-darwin
|
|
- name: Download build artifact build-x86_64-unknown-linux-gnu
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-x86_64-unknown-linux-gnu
|
|
path: target/x86_64-unknown-linux-gnu
|
|
|
|
- name: Download cross-build artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: cross-build
|
|
path: target/cross
|
|
|
|
- name: Download build artifact build-x86_64-pc-windows-msvc
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-x86_64-pc-windows-msvc
|
|
path: target/x86_64-pc-windows-msvc
|
|
- name: Download build artifact build-debian-x86_64
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-debian-x86_64
|
|
path: target/debian-x86_64
|
|
|
|
- name: Package
|
|
run: |
|
|
set -x
|
|
|
|
cd target
|
|
mkdir files
|
|
mv cross/* .
|
|
|
|
cd aarch64-apple-darwin
|
|
chmod +x martin mbtiles
|
|
tar czvf ../files/martin-Darwin-aarch64.tar.gz martin mbtiles
|
|
cd ..
|
|
|
|
cd x86_64-apple-darwin
|
|
chmod +x martin mbtiles
|
|
tar czvf ../files/martin-Darwin-x86_64.tar.gz martin mbtiles
|
|
cd ..
|
|
|
|
cd x86_64-unknown-linux-gnu
|
|
chmod +x martin mbtiles
|
|
tar czvf ../files/martin-Linux-x86_64.tar.gz martin mbtiles
|
|
cd ..
|
|
|
|
cd aarch64-unknown-linux-musl
|
|
chmod +x martin mbtiles
|
|
tar czvf ../files/martin-Linux-aarch64-musl.tar.gz martin mbtiles
|
|
cd ..
|
|
|
|
cd x86_64-unknown-linux-musl
|
|
chmod +x martin mbtiles
|
|
tar czvf ../files/martin-Linux-x86_64-musl.tar.gz martin mbtiles
|
|
cd ..
|
|
|
|
#
|
|
# Special case for Windows
|
|
#
|
|
cd x86_64-pc-windows-msvc
|
|
7z a ../files/martin-Windows-x86_64.zip martin.exe mbtiles.exe
|
|
cd ..
|
|
|
|
#
|
|
# Special case for Debian .deb package
|
|
#
|
|
cd debian-x86_64
|
|
mv debian-x86_64.deb ../files/martin-Debian-x86_64.deb
|
|
cd ..
|
|
|
|
- name: Create Homebrew config
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
set -x
|
|
|
|
# Extract Github release version only without the "v" prefix
|
|
MARTIN_VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/tags\/v//')
|
|
|
|
mkdir -p target/homebrew
|
|
cd target
|
|
|
|
cat << EOF > homebrew_config.yaml
|
|
version: "$MARTIN_VERSION"
|
|
macos_arm_sha256: "$(shasum -a 256 files/martin-Darwin-aarch64.tar.gz | cut -d' ' -f1)"
|
|
macos_intel_sha256: "$(shasum -a 256 files/martin-Darwin-x86_64.tar.gz | cut -d' ' -f1)"
|
|
linux_arm_sha256: "$(shasum -a 256 files/martin-Linux-aarch64-musl.tar.gz | cut -d' ' -f1)"
|
|
linux_intel_sha256: "$(shasum -a 256 files/martin-Linux-x86_64-musl.tar.gz | cut -d' ' -f1)"
|
|
EOF
|
|
|
|
- name: Save Homebrew Config
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: homebrew-config
|
|
path: target/homebrew_config.yaml
|
|
|
|
- name: Publish
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
draft: true
|
|
files: 'target/files/*'
|
|
body_path: CHANGELOG.md
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Checkout maplibre/homebrew-martin
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: maplibre/homebrew-martin
|
|
token: ${{ secrets.GH_HOMEBREW_MARTIN_TOKEN }}
|
|
path: target/homebrew
|
|
|
|
- name: Create Homebrew formula
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: cuchi/jinja2-action@v1.2.1
|
|
with:
|
|
template: .github/templates/homebrew.martin.rb.j2
|
|
output_file: target/homebrew/martin.rb
|
|
data_file: target/homebrew_config.yaml
|
|
|
|
- name: Create a PR for maplibre/homebrew-martin
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
# Create a personal access token
|
|
# Gen: https://github.com/settings/personal-access-tokens/new
|
|
# Set: https://github.com/maplibre/martin/settings/secrets/actions/GH_HOMEBREW_MARTIN_TOKEN
|
|
# Docs: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token
|
|
# Name: anything descriptive
|
|
# One year long (sadly that's max)
|
|
# Repository owner and repo: maplibre/homebrew-martin
|
|
# Access Contents: Read and write
|
|
# Access Metadata: Read-only
|
|
# Access Pull requests: Read and write
|
|
token: ${{ secrets.GH_HOMEBREW_MARTIN_TOKEN }}
|
|
commit-message: "Update to ${{ github.ref }}"
|
|
title: "Update to ${{ github.ref }}"
|
|
body: "Update to ${{ github.ref }}"
|
|
branch: "update-to-${{ github.ref }}"
|
|
branch-suffix: timestamp
|
|
base: "main"
|
|
labels: "auto-update"
|
|
assignees: "nyurik"
|
|
draft: false
|
|
delete-branch: true
|
|
path: target/homebrew
|
|
|
|
# This final step is needed to mark the whole workflow as successful
|
|
# Don't change its name - it is used by the merge protection rules
|
|
done:
|
|
name: CI Finished
|
|
runs-on: ubuntu-latest
|
|
needs: [ package ]
|
|
steps:
|
|
- name: Finished
|
|
run: echo "CI finished successfully"
|