-
Notifications
You must be signed in to change notification settings - Fork 46
284 lines (252 loc) · 10.4 KB
/
main.yaml
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Continuous integration
on:
push:
pull_request:
env:
HAS_SECRETS: ${{ secrets.HAS_SECRETS }}
jobs:
not-failed-backport:
runs-on: ubuntu-22.04
name: Test that's not a failed backport
timeout-minutes: 5
steps:
- run: 'false'
if: "github.event.head_commit.message == '[skip ci] Add instructions to finish the backport.'"
main:
runs-on: ubuntu-22.04
name: Continuous integration
timeout-minutes: 120
if: "!startsWith(github.event.head_commit.message, '[skip ci] ')"
env:
MAIN_BRANCH: '2.7'
MAJOR_VERSION: '2.7'
steps:
- run: '! ls BACKPORT_TODO'
- run: df -h
- run: docker system prune --all --force
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}
if: env.HAS_SECRETS == 'HAS_SECRETS'
- uses: actions/checkout@v2
with:
fetch-depth: 0
if: env.HAS_SECRETS != 'HAS_SECRETS'
- uses: camptocamp/initialise-gopass-summon-action@v2
with:
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}}
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}}
patterns: pypi docker transifex
if: env.HAS_SECRETS == 'HAS_SECRETS'
- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
- run: python3 -m pip install --user --requirement=ci/requirements.txt
- run: |
python3 -m venv /tmp/venv
/tmp/venv/bin/pip install c2cciutils==1.4.13
/tmp/venv/bin/c2cciutils-download-applications --applications-file=ci/applications.yaml \
--versions-file=ci/applications-versions.yaml
rm -rf /tmp/venv
- name: Checks
run: c2cciutils-checks
- run: python3 -m pip install --user --requirement=requirements.txt
# Build images
- run: make build-runner
- run: make build-tools
- run: make checks
if: always()
- run: make build-config
# Build and lint QGIS images
- run: docker build --target=lint --build-arg=VERSION=3.22 docker/qgisserver
- run: QGIS_VERSION=3.28-gdal3.7 make build-qgisserver
# Tests
- run: make preparetest
- run: docker-compose logs --timestamps
if: failure()
# Similar to: make tests-commons
- run: >
docker-compose exec -T tests coverage run
--source=/opt/c2cgeoportal/commons/c2cgeoportal_commons
--module pytest --verbose --color=yes --junitxml=/tmp/commons.xml
/opt/c2cgeoportal/commons/tests
- run: c2cciutils-docker-logs
# Similar to: make tests-geoportal
- run: >
docker-compose exec -T tests coverage run --append
--source=/opt/c2cgeoportal/geoportal/c2cgeoportal_geoportal
--module pytest --verbose --color=yes --junitxml=/tmp/geoportal.xml
/opt/c2cgeoportal/geoportal/tests
- run: c2cciutils-docker-logs
# Similar to: make tests-admin
- run: >
docker-compose exec -T tests coverage run --append
--source=/opt/c2cgeoportal/admin/c2cgeoportal_admin
--module pytest --verbose --color=yes --junitxml=/tmp/admin.xml
/opt/c2cgeoportal/admin/tests
- run: c2cciutils-docker-logs
# Similar to: make tests-qgisserver
- run: >
docker-compose exec -T qgisserver-tests coverage run
--source=/var/www/plugins/geomapfish_qgisserver
--module pytest --verbose --color=yes --junitxml=/tmp/qgis.xml
/src/tests/functional
- run: c2cciutils-docker-logs
- name: Extract tests artifacts
run: |
docker-compose exec -T tests coverage report
docker-compose exec -T tests coverage html --directory=/tmp/coverage
docker-compose exec -T qgisserver-tests coverage report
docker-compose exec -T qgisserver-tests coverage html --directory=/tmp/coverage
mkdir --parent artifacts/geoportal-coverage
mkdir --parent artifacts/qgisserver-plugin-coverage
docker cp c2cgeoportal_tests_1:/tmp/coverage/ artifacts/geoportal-coverage/
docker cp c2cgeoportal_qgisserver-tests_1:/tmp/coverage/ artifacts/qgisserver-plugin-coverage/
if: always()
continue-on-error: true
- run: c2cciutils-docker-logs
if: always()
- run: docker-compose down
- uses: actions/upload-artifact@v2
with:
name: Geoportal coverage
path: artifacts/geoportal-coverage/
if-no-files-found: ignore
retention-days: 5
- uses: actions/upload-artifact@v2
with:
name: QGISserver plugin coverage
path: artifacts/qgisserver-plugin-coverage/
if-no-files-found: ignore
retention-days: 5
- run: sudo git clean -fdx
# Documentation
- run: >
docker build --tag=camptocamp/geomapfish-doc
--build-arg=MAJOR_VERSION=${MAJOR_VERSION}
--build-arg=MAIN_BRANCH=${MAIN_BRANCH}
doc
- name: Extract documentation
run: ci/extract-documentation artifacts/documentations/ || true
if: always()
- uses: actions/upload-artifact@v2
if: always()
with:
name: Documentation
path: artifacts/documentations/
if-no-files-found: ignore
retention-days: 5
# Use minimal version from the documentation
- uses: actions/setup-python@v4
with:
# When we upgrade this we should also upgrade the requirements
# in the documentation: doc/integrator/requirements.rst
python-version: '3.7'
# When we upgrade this we should also upgrade the requirements
# in the documentation: doc/integrator/requirements.rst
# netifaces is for 2.4
- run: pip install --user PyYAML==3.13 docker-compose==1.21.0 netifaces
# Test App
- run: ci/test-app
- name: Docker logs
run: |
cd ${HOME}/workspace/testgeomapfishapp/
c2cciutils-docker-logs
if: failure()
continue-on-error: true
- run: git pull --ff-only origin ${{ env.MAIN_BRANCH }}
if: >
github.ref == format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
- run: scripts/get-version --auto-increment --github
id: version
# Test Upgrade
- run: DOCKER_TAG=${{ steps.version.outputs.full }} make build-tools
- run: DOCKER_TAG=${{ steps.version.outputs.full }} make build-runner
- run: DOCKER_TAG=${{ steps.version.outputs.full }} make build-config
- run: docker images | grep "<none>" | awk '{print $3}' | xargs --no-run-if-empty docker rmi || true
- run: ci/test-upgrade init ${HOME}/workspace
- run: ci/test-upgrade 240 ${HOME}/workspace
- run: ci/test-upgrade 260 ${HOME}/workspace
- run: ci/test-upgrade 27 ${HOME}/workspace
- run: ci/test-upgrade cleanup ${HOME}/workspace
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install --user PyYAML==5.3.1 docker==6.1.3 docker-compose==1.29.2 wheel==0.40.0
- name: Init Git
run:
git remote set-url origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository
}}
- run: make build-tools
- run: make build-runner
- run: make build-config
- run: ci/create-new-project ${HOME}/workspace geomapfishapp
- run: (cd ${HOME}/workspace/geomapfishapp/; ./build)
- name: Update the changelog
run: ci/changelog ${{ steps.version.outputs.full }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: git diff CHANGELOG.md
- name: Push version and changelog
run: |
set -eux
git add ci/ci.yaml ci/changelog.yaml CHANGELOG.md
git diff --staged --quiet || (\
git commit -m "[skip ci] Update the minor version"; \
git push origin HEAD:${{ env.MAIN_BRANCH }} \
)
if: >
github.ref == format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
- name: Publish feature branch
run: |
c2cciutils-publish
c2cciutils-publish --group=full
if: >
github.ref != format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
&& ! contains(github.ref_name, '/')
- name: Publish version branch
run: |
c2cciutils-publish --type=version_branch --version=${{ steps.version.outputs.major }}
c2cciutils-publish --type=version_branch --version=${{ steps.version.outputs.major_minor }}
c2cciutils-publish --group=full --type=version_branch --version=${{ steps.version.outputs.full }}
if: >
github.ref == format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
- name: Notify demo
run: >
curl --request POST --header "Content-Type: application/json"
--header 'Accept: application/vnd.github.v3+json'
--header "Authorization: token ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}"
https://api.github.com/repos/camptocamp/demo_geomapfish/dispatches
--data '{"event_type": "geomapfish_${{ env.MAJOR_VERSION }}_updated",
"client_payload": {"version": "'"${{ steps.version.outputs.upgrade_version }}"'"}}'
if: >
github.ref == format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
- name: Publish to Transifex
run: |
docker build --target=tools --tag=transifex --build-arg=MAJOR_VERSION=${MAJOR_VERSION} .
docker run --name=transifex -ti --rm --detach --volume=${HOME}:/root transifex tail -f /dev/null
docker exec transifex bash -c \
'(cd /opt/c2cgeoportal; make --makefile=dependencies.mk transifex-send)'
docker stop transifex
if: >
github.ref == format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
- name: Publish documentation to GitHub.io
run: ci/publish-documentation
if: >
github.ref == format('refs/heads/{0}', env.MAIN_BRANCH)
&& env.HAS_SECRETS == 'HAS_SECRETS'
- run: >
docker run --rm --volume=/var/run/docker.sock:/var/run/docker.sock nate/dockviz
images --tree
if: always()
- run: docker images
if: always()
- run: docker system df
if: always()
- run: df -h
if: always()