forked from lock042/siril
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
380 lines (355 loc) · 12.6 KB
/
.gitlab-ci.yml
File metadata and controls
380 lines (355 loc) · 12.6 KB
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
################################################################################
# Gitlab CI YAML configuration file
################################################################################
################################################################################
# Global definitions
image: debian:testing
# Our general workflow rules, see relevant documentation here:
# https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html
# https://docs.gitlab.com/ee/ci/yaml/#rules
#
# We also run everything for schedules (which you can't tell from looking
# at these rule alone).
workflow:
rules:
# run merge request pipelines
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# do not run branch pipelines if corresponding merge requests exist...
# (this avoids duplicate pipelines)
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
# ...but otherwise run branch pipelines
- if: '$CI_COMMIT_BRANCH'
# run tag pipelines
- if: '$CI_COMMIT_TAG'
# A few jobs are only supposed to run either on demand, on schedule (i.e.
# weekly) or on tag (i.e. release).
.run_ondemand_schedule_tag: &run_ondemand_schedule_tag
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_COMMIT_TAG'
- when: manual
stages:
- prepare
- dependencies
- siril
- packaging
- distribution
- analysis
variables:
GIT_DEPTH: "1"
IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
BUILD_DIR: "_build"
INSTALL_DIR: "siril"
INSTALL_PREFIX: "${CI_PROJECT_DIR}/${INSTALL_DIR}"
CROSSROAD_OUT: "crossroad-out"
APT_CACHE: "$CI_PROJECT_DIR/apt-cache"
################################################################################
# Prepare Dockers images
# Image for GNU/Linux build
build-image:
stage: prepare
cache: {}
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context build/build-image/ --dockerfile build/build-image/Dockerfile.debian-latest --destination $CI_REGISTRY_IMAGE/$IMAGE_TAG:build-debian-latest --cache=true --cache-ttl=120h
# Image for GNU/Linux build
build-image-oldstable:
stage: prepare
cache: {}
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context build/build-image/ --dockerfile build/build-image/Dockerfile.debian-oldstable --destination $CI_REGISTRY_IMAGE/$IMAGE_TAG:build-debian-oldstable --cache=true --cache-ttl=120h
################################################################################
# GNU/Linux 64-bit CIs
# Currently Siril does not need dependency compilation, so we can skip that.
deps-debian:
stage: dependencies
image: $CI_REGISTRY_IMAGE/$IMAGE_TAG:build-debian-latest
cache:
paths:
- apt-cache
artifacts:
expire_in: 2 hours
when: always
paths:
- "${INSTALL_DIR}"
- _Criterion/_build
before_script:
- git clone --recurse-submodules --depth=1 -b bleeding https://github.com/Snaipe/Criterion.git _Criterion
- export PKG_CONFIG_PATH="${INSTALL_PREFIX}/lib/pkgconfig"
- export PKG_CONFIG_PATH="${INSTALL_PREFIX}/lib/`gcc -print-multiarch`/pkgconfig/:$PKG_CONFIG_PATH"
- export LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}"
- export LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib/`gcc -print-multiarch`:$LD_LIBRARY_PATH"
- export XDG_DATA_DIRS="${INSTALL_PREFIX}/share:/usr/local/share:/usr/share"
script:
- cd _Criterion
- patch --binary -p1 < ../build/criterion.patch
- meson setup _build --prefix ${INSTALL_PREFIX}
- ninja -C _build install
needs: ["build-image"]
.siril-debian/testing-base:
stage: siril
image: $CI_REGISTRY_IMAGE/$IMAGE_TAG:build-debian-latest
dependencies:
- deps-debian
variables:
GIT_SUBMODULE_STRATEGY: recursive
cache:
paths:
- apt-cache
artifacts:
expire_in: 1 week
when: always
name: "app-build-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
paths:
- ${BUILD_DIR}
- ${INSTALL_DIR}
before_script:
- export PKG_CONFIG_PATH="${INSTALL_PREFIX}/lib/pkgconfig:${INSTALL_PREFIX}/share/pkgconfig"
- export PKG_CONFIG_PATH="${INSTALL_PREFIX}/lib/`gcc -print-multiarch`/pkgconfig/:$PKG_CONFIG_PATH"
- export PKG_CONFIG_PATH="${INSTALL_PREFIX}/share/`gcc -print-multiarch`/pkgconfig/:$PKG_CONFIG_PATH"
- export LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}"
- export LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib/`gcc -print-multiarch`:$LD_LIBRARY_PATH"
- export XDG_DATA_DIRS="${INSTALL_PREFIX}/share:/usr/local/share:/usr/share"
- export PATH="${INSTALL_PREFIX}/bin:$PATH"
needs: ["deps-debian"]
siril-deb-meson:
extends: .siril-debian/testing-base
script:
- meson setup --prefix="${INSTALL_PREFIX}" ${BUILD_DIR} -Db_coverage=true -Dcriterion=true
- ninja -C ${BUILD_DIR} install
- meson test -C ${BUILD_DIR} -v --no-suite perfs
- cd ${BUILD_DIR}
# - gcovr --xml-pretty --exclude-unreachable-branches --exclude-directories subprojects --exclude-directories src/tests --root ../ -o coverage.xml --print-summary
- cd ..
artifacts:
paths:
- ${BUILD_DIR}/meson-logs/testlog.junit.xml
- ${BUILD_DIR}/coverage.xml
reports:
junit: ${BUILD_DIR}/meson-logs/testlog.junit.xml
coverage_report:
coverage_format: cobertura
path: ${BUILD_DIR}/coverage.xml
################################################################################
# Packaging
################################################################################
# macOS CI
macos:
stage: packaging
parallel:
matrix:
- ARCHITECTURE: [ "arm64", "x86_64" ]
rules:
- if: $CI_PROJECT_NAMESPACE != "free-astro" && $CI_PROJECT_NAMESPACE != "dehesselle"
when: never # job requires custom runner, not suitable outside the project
- if: $ARCHITECTURE == "arm64"
variables:
SDKROOT: /opt/sdks/MacOSX11.3.sdk
- if: $ARCHITECTURE == "x86_64"
when: manual
allow_failure: true
variables:
SDKROOT: /opt/sdks/MacOSX10.15.6.sdk
tags:
- macos
- ${ARCHITECTURE}
variables:
CCACHE_DIR: /Users/Shared/work/ccache
REP_DIR: $CI_PROJECT_DIR
SIRIL_BUILD: $CI_PIPELINE_IID
SM_REPO_REF: 87be2d6e8dd536849f7da0fa47e79bb1e2effa7f
SM_REPO_URL: https://gitlab.com/free-astro/siril_macos.git
WRK_DIR: $CI_PROJECT_DIR
script:
# Clone the repo containing all the build scripts.
- |
git clone $SM_REPO_URL sm
git -C sm checkout $SM_REPO_REF
git -C sm submodule update --recursive --init
# Build the dependencies and then Siril. Dependencies are uploaded to the
# package registry so they don't have to be rebuilt every time if there
# haven't been any changes. Changes to dependencies are detected by
# checksumming all the files and using that checksum as a version number.
- |
echo $CI_PROJECT_DIR > sm/ci_project_dir.txt
SM_SHA=$(LANG=C find -s sm -type f -not -wholename '*.git/*' -exec cat {} \+ | shasum | awk '{ print $1 }')
VER_DIR=$(sm/jhb/usr/bin/config get VER_DIR)
PACKAGE_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/macos-deps/${SM_SHA}/$(basename $VER_DIR)_${ARCHITECTURE}.dmg
if ! curl -H "JOB-TOKEN: $CI_JOB_TOKEN" -fLO $PACKAGE_URL; then
export FORCE_BUILD_FROM_SOURCE=true
sm/build_toolset.sh
sm/jhb/usr/bin/jhb run rustup self uninstall -y || true
sm/jhb/usr/bin/archive remove_nonessentials
sm/jhb/usr/bin/archive create_dmg
curl --fail-with-body -H "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $(basename $PACKAGE_URL) $PACKAGE_URL
rm -rf ${VER_DIR:?}
unset FORCE_BUILD_FROM_SOURCE
fi
- sm/jhb/usr/bin/archive install_dmg
- sm/build_siril.sh
after_script:
- sm/jhb/usr/bin/archive uninstall_dmg
needs: []
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 1 week
paths:
- Siril*.dmg
# Fetch msys2/mingw64 image from siril-windows
# Build siril and package it
win64-native:
stage: packaging
cache:
key: "cache-windows"
paths:
- ccache
- DLLcache
when: always
variables:
CCACHE_DIR: $CI_PROJECT_DIR/ccache
CCACHE_MAXSIZE: "1.0G"
CHERE_INVOKING: "yes"
MSYSTEM: "MINGW64"
# SDW = Siril Deps Windows, https://gitlab.com/free-astro/siril_windows
SDW_VERSION: 30
SDW_NAME: siril$SDW_VERSION
SDW_RELEASE_URL: $CI_API_V4_URL/projects/47854290/packages/generic/windows/r$SDW_VERSION/$SDW_NAME.7z
W64_OUT: "/c/$SDW_NAME/mingw64" #used in siril-package.sh
tags:
- saas-windows-medium-amd64
needs: []
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- ${INSTALL_DIR}
before_script:
- wget.exe --quiet --no-check-certificate $SDW_RELEASE_URL
- 7z x -oC:/ "$Env:SDW_NAME.7z"
script:
- . "C:/$Env:SDW_NAME/msys2_shell.cmd" -defterm -no-start -c "bash -x ./build/windows/native-gitlab-ci/siril-build.sh"
- . "C:/$Env:SDW_NAME/msys2_shell.cmd" -defterm -no-start -c "bash -x ./build/windows/native-gitlab-ci/siril-package.sh"
flatpak:
rules:
*run_ondemand_schedule_tag
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
stage: packaging
variables:
MANIFEST_PATH: "build/flatpak/org.siril.Siril.json"
FLATPAK_MODULE: "siril"
APP_ID: "org.siril.Siril"
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
BUNDLE: "org.siril.Siril.flatpak"
GIT_SUBMODULE_STRATEGY: recursive
script:
- flatpak-builder --verbose --disable-rofiles-fuse --ccache --repo=repo ${BRANCH:+--default-branch=$BRANCH} flatpak_app ${MANIFEST_PATH}
- flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
artifacts:
name: "Flatpak artifacts"
expose_as: "Get Flatpak bundle here"
when: always
paths:
- "${BUNDLE}"
- "repo/"
expire_in: 1 week
cache:
# key: "$CI_JOB_NAME"
paths:
- ".flatpak-builder/downloads"
- ".flatpak-builder/git"
- ".flatpak-builder/cache"
- ".flatpak-builder/ccache"
needs: []
allow_failure: true
appimage:
stage: packaging
image: $CI_REGISTRY_IMAGE/$IMAGE_TAG:build-debian-oldstable
variables:
GIT_SUBMODULE_STRATEGY: recursive
cache:
paths:
- apt-cache
before_script:
- apt-get install -y wget
script:
- bash -ex build/appimage/generate.sh
artifacts:
expire_in: 1 week
paths:
- build/appimage/Siril*.AppImage*
needs: ["build-image-oldstable"]
allow_failure: true
################################################################################
# Analysis
cppcheck:
stage: analysis
before_script:
- apt-get update
- apt-get install -y cppcheck
script:
- cppcheck -q -j8 --enable=all --force --output-file=cppcheck.xml --xml --xml-version=2
-i _build -i _deps -i ${INSTALL_PREFIX} -i subprojects -i src/rt -i src/io/avi_pipp -i .local -i .cache .
- mkdir report
- cppcheck-htmlreport --source-dir=. --title=siril --file=cppcheck.xml --report-dir=report
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 1 week
when: always
paths:
- report
needs: []
################################################################################
# Distribution
win64-native-installer:
rules:
*run_ondemand_schedule_tag
variables:
CHERE_INVOKING: "yes"
tags:
- saas-windows-medium-amd64
stage: distribution
dependencies:
- win64-native
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- WinInstaller
- installer.log
script:
- choco install innosetup -y
- powershell -File .\build\windows\installer\siril-win-installer.ps1 2>&1 > installer.log
needs: ["win64-native"]
allow_failure: true
################################################################################
build-paper:
rules:
*run_ondemand_schedule_tag
stage: distribution
image: docker:latest
services:
- docker:dind
artifacts:
expire_in: 1 week
when: always
paths:
- paper/paper.pdf
before_script:
- apk update
- apk add --no-cache docker-compose
script:
- docker run --rm --volume "$CI_PROJECT_DIR/paper:/data" --user "$(id -u):$(id -g)" --env JOURNAL=joss openjournals/inara
needs: []
dependencies: []
allow_failure: true