2022-11-19 13:32:23 +03:00
|
|
|
name: Docker
|
2022-11-02 21:00:05 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-06-04 05:50:55 +03:00
|
|
|
branches: [main]
|
2023-05-30 04:00:44 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
|
|
|
- 'demo/**'
|
|
|
|
- 'docs/**'
|
|
|
|
- 'homebrew-formula/**'
|
2022-11-02 21:00:05 +03:00
|
|
|
pull_request:
|
2023-06-04 05:50:55 +03:00
|
|
|
branches: [main]
|
2023-05-30 04:00:44 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
|
|
|
- 'demo/**'
|
|
|
|
- 'docs/**'
|
|
|
|
- 'homebrew-formula/**'
|
2022-11-02 21:00:05 +03:00
|
|
|
release:
|
2022-12-04 08:34:13 +03:00
|
|
|
types: [published]
|
2022-11-02 21:00:05 +03:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
2022-11-19 13:32:23 +03:00
|
|
|
# Don't change this name - it is used by the merge protection rules
|
2023-03-28 09:28:55 +03:00
|
|
|
name: Build ${{ matrix.platform }} docker image
|
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- platform: linux/amd64
|
|
|
|
file: Dockerfile
|
2023-05-09 23:39:49 +03:00
|
|
|
# Arm64 does not publish properly, see #655
|
|
|
|
# - platform: linux/arm64
|
|
|
|
# file: arm64.Dockerfile
|
|
|
|
|
2022-11-02 21:00:05 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
# https://github.com/docker/metadata-action
|
|
|
|
- name: Docker meta
|
|
|
|
id: docker_meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
2023-03-16 23:01:33 +03:00
|
|
|
images: ghcr.io/maplibre/martin
|
2022-11-02 21:00:05 +03:00
|
|
|
|
2023-05-09 23:39:49 +03:00
|
|
|
# # https://github.com/docker/setup-qemu-action
|
|
|
|
# - name: Set up QEMU
|
|
|
|
# uses: docker/setup-qemu-action@v2.1.0
|
|
|
|
# with:
|
|
|
|
# platforms: linux/arm64,linux/amd64
|
2022-11-02 21:00:05 +03:00
|
|
|
|
|
|
|
# https://github.com/docker/setup-buildx-action
|
|
|
|
- name: Set up Docker Buildx
|
2023-06-14 02:32:56 +03:00
|
|
|
uses: docker/setup-buildx-action@v2.7.0
|
2022-11-02 21:00:05 +03:00
|
|
|
with:
|
|
|
|
install: true
|
2023-05-09 23:39:49 +03:00
|
|
|
# platforms: ${{ matrix.platform }}
|
2022-11-02 21:00:05 +03:00
|
|
|
|
|
|
|
- name: Build the Docker image
|
|
|
|
id: docker_build
|
2023-01-31 14:50:10 +03:00
|
|
|
uses: docker/build-push-action@v4
|
2022-11-02 21:00:05 +03:00
|
|
|
with:
|
2023-03-28 09:28:55 +03:00
|
|
|
file: ${{ matrix.file }}
|
2022-11-02 21:00:05 +03:00
|
|
|
push: false
|
|
|
|
load: true
|
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2023-05-09 23:39:49 +03:00
|
|
|
# platforms: ${{ matrix.platform }}
|
2022-11-02 21:00:05 +03:00
|
|
|
|
|
|
|
- name: Start postgres
|
2023-05-09 23:39:49 +03:00
|
|
|
# arm64 testing cannot be tested in a cross-platform env
|
2023-03-28 09:28:55 +03:00
|
|
|
if: matrix.platform == 'linux/amd64'
|
2022-11-02 21:00:05 +03:00
|
|
|
uses: nyurik/action-setup-postgis@v1
|
|
|
|
id: pg
|
|
|
|
with:
|
|
|
|
username: test
|
|
|
|
password: test
|
|
|
|
database: test
|
|
|
|
rights: --superuser
|
|
|
|
|
|
|
|
- name: Init database
|
2023-05-09 23:39:49 +03:00
|
|
|
# arm64 testing cannot be tested in a cross-platform env
|
2023-03-28 09:28:55 +03:00
|
|
|
if: matrix.platform == 'linux/amd64'
|
2022-11-02 21:00:05 +03:00
|
|
|
shell: bash
|
|
|
|
run: tests/fixtures/initdb.sh
|
|
|
|
env:
|
|
|
|
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
|
|
|
|
|
|
|
|
- name: Test Docker image
|
2023-05-09 23:39:49 +03:00
|
|
|
# arm64 testing cannot be tested in a cross-platform env
|
2023-03-28 09:28:55 +03:00
|
|
|
if: matrix.platform == 'linux/amd64'
|
2022-11-02 21:00:05 +03:00
|
|
|
run: |
|
2022-11-19 21:31:18 +03:00
|
|
|
TAG=$(echo '${{ steps.docker_meta.outputs.json }}' | jq -r '.tags[0]')
|
2023-06-04 01:54:50 +03:00
|
|
|
export MBTILES_BUILD=-
|
|
|
|
export MBTILES_BIN=-
|
2022-11-02 21:00:05 +03:00
|
|
|
export MARTIN_BUILD=-
|
2022-11-19 13:32:23 +03:00
|
|
|
export MARTIN_BIN="docker run --rm --net host -e DATABASE_URL -v $PWD/tests:/tests $TAG"
|
2022-11-19 21:31:18 +03:00
|
|
|
echo "MARTIN_BIN=$MARTIN_BIN"
|
2022-11-02 21:00:05 +03:00
|
|
|
tests/test.sh
|
|
|
|
env:
|
|
|
|
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
|
|
|
|
|
2023-03-16 23:01:33 +03:00
|
|
|
- name: Login to GitHub Docker registry
|
2022-11-02 21:00:05 +03:00
|
|
|
uses: docker/login-action@v2
|
|
|
|
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork }}
|
|
|
|
with:
|
2023-03-16 23:01:33 +03:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-11-02 21:00:05 +03:00
|
|
|
|
|
|
|
- name: Push the Docker image
|
|
|
|
if: ${{ github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' }}
|
2023-01-31 14:50:10 +03:00
|
|
|
uses: docker/build-push-action@v4
|
2022-11-02 21:00:05 +03:00
|
|
|
with:
|
2023-03-29 03:15:15 +03:00
|
|
|
file: ${{ matrix.file }}
|
2022-11-02 21:00:05 +03:00
|
|
|
push: true
|
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2023-05-09 23:39:49 +03:00
|
|
|
# platforms: ${{ matrix.platform }}
|