-
-
Notifications
You must be signed in to change notification settings - Fork 219
122 lines (109 loc) · 3.6 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Docker
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
release:
types: [ published ]
workflow_dispatch:
jobs:
docker:
# Don't change this name - it is used by the merge protection rules
name: Build ${{ matrix.platform }} docker image
strategy:
fail-fast: true
matrix:
include:
- platform: linux/amd64
file: Dockerfile
# Arm64 does not publish properly, see #655
# - platform: linux/arm64
# file: arm64.Dockerfile
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
# https://github.com/docker/metadata-action
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/maplibre/martin
# # https://github.com/docker/setup-qemu-action
# - name: Set up QEMU
# uses: docker/[email protected]
# with:
# platforms: linux/arm64,linux/amd64
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
install: true
# platforms: ${{ matrix.platform }}
- name: Build the Docker image
id: docker_build
uses: docker/build-push-action@v5
with:
file: ${{ matrix.file }}
push: false
load: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
# platforms: ${{ matrix.platform }}
- name: Start postgres
# arm64 testing cannot be tested in a cross-platform env
if: matrix.platform == 'linux/amd64'
uses: nyurik/action-setup-postgis@v1
id: pg
with:
username: test
password: test
database: test
rights: --superuser
- name: Init database
# arm64 testing cannot be tested in a cross-platform env
if: matrix.platform == 'linux/amd64'
shell: bash
run: tests/fixtures/initdb.sh
env:
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
- name: Test Docker image
# arm64 testing cannot be tested in a cross-platform env
if: matrix.platform == 'linux/amd64'
run: |
TAG=$(echo '${{ steps.docker_meta.outputs.json }}' | jq -r '.tags[0]')
export MBTILES_BUILD=-
export MBTILES_BIN=-
export MARTIN_BUILD=-
export MARTIN_BIN="docker run --rm --net host -e DATABASE_URL -v $PWD/tests:/tests $TAG"
echo "MARTIN_BIN=$MARTIN_BIN"
tests/test.sh
env:
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}
- name: Login to GitHub Docker registry
uses: docker/login-action@v3
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push the Docker image
if: ${{ github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' }}
uses: docker/build-push-action@v5
with:
file: ${{ matrix.file }}
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
# platforms: ${{ matrix.platform }}