-
-
Notifications
You must be signed in to change notification settings - Fork 24
141 lines (117 loc) · 4.78 KB
/
build_docker_images.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Auto build QGIS server Docker images
on:
schedule:
# runs once a week
- cron: '0 6 * * 0'
# runs every day
# - cron: '0 6 * * *'
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
env:
DEFAULT_UBUNTU_RELEASE: noble # for the default dist, no suffix to tag
DOCKER_CLI_EXPERIMENTAL: enabled
jobs:
build-nightly:
runs-on: ubuntu-latest
name: build nightly
strategy:
fail-fast: false
matrix:
qgis_type: [ 'desktop', 'server' ]
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: define tag
run: |
echo "DOCKER_TAG=$( [[ ${{ matrix.qgis_type }} = 'server' ]] && echo 'qgis-server' || echo 'qgis' )" >> $GITHUB_ENV
- id: nightly
name: building nightly
run: docker build -t qgis/${{ env.DOCKER_TAG }}:nightly --build-arg repo=ubuntu-nightly -f ${{ matrix.qgis_type }}/Dockerfile .
- name: test
if: ${{ matrix.qgis_type == 'server' }}
run: |
docker run -d -v $(pwd)/${{ matrix.qgis_type }}/test/data:/io/data -p 8010:80 --name qgis-server qgis/qgis-server:nightly
docker exec -i qgis-server dpkg -l qgis-server
sleep 5
curl -s 'http://localhost:8010/ogc/test_project?service=WMS&request=GetCapabilities' | grep -ivq exception
- name: push
if: ${{ github.event_name != 'pull_request' }}
run: |
docker push qgis/${{ env.DOCKER_TAG }}:nightly
docker tag qgis/${{ env.DOCKER_TAG }}:nightly qgis/${{ env.DOCKER_TAG }}:latest
docker push qgis/${{ env.DOCKER_TAG }}:latest
build:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
name: build
strategy:
fail-fast: false
matrix:
qgis_type: ['desktop', 'server']
version: ['stable', 'ltr']
platform:
- os: ubuntu
release: jammy
- os: ubuntu
release: noble
- os: debian
release: bookworm
steps:
- uses: actions/checkout@v4
- id: python_deps
run: pip3 install packaging
- id: determine
name: determine QGIS and Docker versions
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
run : |
DOCKER=$(./scripts/get_docker_image_version.py --qgis=${{ matrix.qgis_type }} --dist=${{ matrix.platform.release }})
QGIS=$(./scripts/get_ubuntu_qgis_package_version.py --qgis=${{ matrix.qgis_type }} --os=${{ matrix.platform.os }} --dist ${{ matrix.platform.release }})
DOCKER_VERSION=$(echo "${DOCKER}" | jq ".${{ matrix.version }}")
QGIS_VERSION=$(echo "${QGIS}" | jq ".${{ matrix.version }}")
echo "Existing ${{ matrix.version }} docker: ${DOCKER_VERSION}"
echo "Available ${{ matrix.version }} QGIS: ${QGIS_VERSION}"
WILL_UPDATE=$(python3 -c "from packaging import version; print(1 if version.parse(${DOCKER_VERSION} or '0') < version.parse(${QGIS_VERSION}) else 0)")
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
echo "Force build on workflow dispatch."
WILL_UPDATE=1
fi
if [[ ${WILL_UPDATE} == 1 ]]; then
echo "--> ${{ matrix.version }} will be updated from ${DOCKER_VERSION} to ${QGIS_VERSION}."
else
echo "--> ${{ matrix.version }} is up to date (${QGIS_VERSION})."
fi
echo "will_update=${WILL_UPDATE}" >> $GITHUB_OUTPUT
echo "qgis_version=${QGIS_VERSION//\"/}">> $GITHUB_OUTPUT
- name: Set up QEMU
if: ${{ steps.determine.outputs.will_update == 1 }}
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: arm64,arm
- name: Set up Docker Buildx
if: ${{ steps.determine.outputs.will_update == 1 }}
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ steps.determine.outputs.will_update == 1 }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: build
if: ${{ steps.determine.outputs.will_update == 1 }}
name: build ubuntu image
env:
DOCKER_USERNAME: ${{ secrets.docker_username }}
DOCKER_PASSWORD: ${{ secrets.docker_password }}
run: ./scripts/build-push-docker.sh ${{ matrix.qgis_type }} ${{ matrix.version }} ${{steps.determine.outputs.qgis_version}} ${{ matrix.platform.os }} ${{ matrix.platform.release }} ${DEFAULT_UBUNTU_RELEASE}