-
Notifications
You must be signed in to change notification settings - Fork 23
/
.gitlab-ci.yml
292 lines (276 loc) · 11.4 KB
/
.gitlab-ci.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
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
# This is a definition file for GitLab CI.
default:
timeout: 360m
stages:
- build
- test
- deploy
#######################################################################################################################
### Building stages.
#######################################################################################################################
# These stages test the Docker implementation scripts for installing and building all needed dependencies, building
# DICOMautomaton, testing the built binaries (within the compilation environment), and then building an AppImage.
# CI build on Debian buster.
# Notes: reduced (or missing) optimization, some components may be missing.
build_ci_debian_buster:
stage: build
tags: [dcma, docker, linux]
needs: []
image: "debian:buster"
before_script:
- "cp -R ./docker/builders/ci /scratch"
- "cp -R . /dcma"
- "./scripts/enable_swapfile.sh"
script:
- |
( ( while true ; do sleep 30 ; printf '\n\n' ; df -h ; printf '\n\n' ; cat /proc/meminfo | grep 'Mem\|Cache\|Swap' ; printf '\n\n' ; done ) &)
./docker/builders/ci/implementation_ci_debian_buster.sh
./integration_tests/Run.sh -v
./scripts/extract_system_appimage.sh
artifacts:
paths:
- "AppDir"
- "DICOMautomaton*AppImage"
expire_in: 55 hours
# CI build on Arch Linux.
# Notes: reduced (or missing) optimization, some components may be missing.
build_ci_arch:
stage: build
tags: [dcma, docker, linux]
needs: []
image: "archlinux:latest"
before_script:
- "cp -R ./docker/builders/ci /scratch"
- "cp -R . /dcma"
- "./scripts/enable_swapfile.sh"
script:
- |
( ( while true ; do sleep 30 ; printf '\n\n' ; df -h ; printf '\n\n' ; cat /proc/meminfo | grep 'Mem\|Cache\|Swap' ; printf '\n\n' ; done ) &)
./docker/builders/ci/implementation_ci_arch.sh
./integration_tests/Run.sh -v
./scripts/extract_system_appimage.sh
artifacts:
paths:
- "AppDir"
- "DICOMautomaton*AppImage"
expire_in: 55 hours
# Perform a cross-compile with MXE.
# Notes: reduced (or missing) optimization, some components may be missing.
cross_compile_mxe:
stage: build
tags: [dcma, docker, linux]
needs: []
image: "hdclark/dcma_build_base_mxe:latest"
before_script:
- "cp -R . /dcma"
- "./scripts/enable_swapfile.sh"
script:
- |
( ( while true ; do sleep 30 ; printf '\n\n' ; df -h ; printf '\n\n' ; cat /proc/meminfo | grep 'Mem\|Cache\|Swap' ; printf '\n\n' ; done ) &)
./docker/builders/mxe/implementation_mxe.sh
rsync -avP /out/ ./Windows/
strip ./Windows/usr/bin/*exe
strip ./Windows/usr/lib/*a
( cd ./Windows/usr/bin/ && mv opengl32.dll opengl32_disabled.dll ) || true
artifacts:
paths:
- "Windows"
expire_in: 55 hours
# CI build on MacOS.
# Notes: some components may be missing.
build_ci_macos:
stage: build
tags: [dcma, macos]
needs: []
allow_failure: true
interruptible: true
variables:
BID: "$CI_COMMIT_SHORT_SHA"
script:
- |
./docker/builders/macos/implementation_macos.sh "${CI_PROJECT_DIR}/${BID}"_workroot "${CI_PROJECT_DIR}/${BID}"_installroot
./scripts/gather_macos_dylibs.sh "${CI_PROJECT_DIR}/${BID}"_installroot "${CI_PROJECT_DIR}/${BID}"_artifacts
rm -rf ci_artifacts && mkdir -pv ci_artifacts && cd ci_artifacts
mv "${CI_PROJECT_DIR}/${BID}"_artifacts artifacts
tar --xz -cf DICOMautomaton-latest-macos_x86_64.txz artifacts
rm -rf artifacts/
export short_sha="$(git rev-parse --short HEAD || printf 'unknown')"
cp DICOMautomaton-latest-macos_x86_64.txz DICOMautomaton-${short_sha}-macos_x86_64.txz
find ./ -iname '*.txz' -print -execdir bash -c 'shasum -a 256 "$@" > "$@".sha256sum' bash '{}' \;
cd ..
rm -rf deploy_key
echo "$HALCLARKCA_DEPLOY_KEY_BASE64" | base64 -d > deploy_key
chmod 600 deploy_key
for i in `seq 1 20` ; do sleep 5 ; rsync -avP -e 'ssh -v -i deploy_key -o ServerAliveInterval=30 -o ServerAliveCountMax=5 -o StrictHostKeyChecking=no' ci_artifacts/ root@halclark.ca:/var/www/html/ci/ && break ; done
rm -rf deploy_key
after_script:
- |
rm -rf "${CI_PROJECT_DIR}/${BID}"_workroot
rm -rf "${CI_PROJECT_DIR}/${BID}"_installroot
rm -rf deploy_key
artifacts:
paths:
- ci_artifacts/DICOMautomaton-latest-macos_x86_64.txz
- ci_artifacts/DICOMautomaton-latest-macos_x86_64.txz.sha256sum
expire_in: 55 hours
#######################################################################################################################
### Testing stages.
#######################################################################################################################
# These stages test the use of AppImage build artifacts on pristine systems. They basically test portability of the
# AppImage distribution.
# Same-system testing.
test_ci_debian_buster_on_debian_buster:
stage: test
tags: [dcma, docker, linux]
needs: ["build_ci_debian_buster"]
image: "debian:buster"
script:
# Provide minimal system libraries.
- "./scripts/install_AppImage_runtime_dependencies.sh"
# Unpack the AppImage and overlay it in the containers root filesystem.
- "chmod 777 DICOMautomaton*AppImage"
- "./DICOMautomaton*AppImage --appimage-extract"
- "rsync -a ./squashfs-root/usr/ /usr/"
# Ensure it can be run and then run tests.
- "ldd $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher || true"
- "dicomautomaton_dispatcher -h"
- "./integration_tests/Run.sh -v"
artifacts:
paths:
- "dcma_integration_testing"
expire_in: 55 hours
test_ci_arch_on_arch:
stage: test
tags: [dcma, docker, linux]
needs: ["build_ci_arch"]
image: "archlinux:latest"
script:
# Provide minimal system libraries.
- "./scripts/install_AppImage_runtime_dependencies.sh"
# Unpack the AppImage and overlay it in the containers root filesystem.
- "chmod 777 DICOMautomaton*AppImage"
- "./DICOMautomaton*AppImage --appimage-extract"
- "rsync -a ./squashfs-root/usr/ /usr/"
# Ensure it can be run and then run tests.
- "ldd $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher || true"
- "dicomautomaton_dispatcher -h"
- "./integration_tests/Run.sh -v"
artifacts:
paths:
- "dcma_integration_testing"
expire_in: 55 hours
# Cross-system testing.
test_ci_debian_buster_on_arch:
stage: test
tags: [dcma, docker, linux]
needs: ["build_ci_debian_buster"]
image: "archlinux:latest"
script:
# Provide minimal system libraries.
- "./scripts/install_AppImage_runtime_dependencies.sh"
# Unpack the AppImage and overlay it in the containers root filesystem.
- "chmod 777 DICOMautomaton*AppImage"
- "./DICOMautomaton*AppImage --appimage-extract"
- "rsync -a ./squashfs-root/usr/ /usr/"
# Ensure it can be run and then run tests.
- "ldd $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher || true"
- "dicomautomaton_dispatcher -h"
- "./integration_tests/Run.sh -v"
artifacts:
paths:
- "dcma_integration_testing"
expire_in: 55 hours
test_ci_debian_buster_on_ubuntu_latest:
stage: test
tags: [dcma, docker, linux]
needs: ["build_ci_debian_buster"]
image: "ubuntu:latest"
script:
# Provide minimal system libraries.
- "./scripts/install_AppImage_runtime_dependencies.sh"
# Unpack the AppImage and overlay it in the containers root filesystem.
#- "wget --no-check-certificate 'http://halclark.ca/ci/DICOMautomaton-latest-x86_64.AppImage'"
- "chmod 777 DICOMautomaton*AppImage"
- "./DICOMautomaton*AppImage --appimage-extract"
- "rsync -a ./squashfs-root/usr/ /usr/"
# Ensure it can be run and then run tests.
- "ldd $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher || true"
- "dicomautomaton_dispatcher -h"
#- git clone 'https://github.com/hdclark/DICOMautomaton'
#- cd DICOMautomaton
- "./integration_tests/Run.sh -v"
artifacts:
paths:
- "dcma_integration_testing"
expire_in: 55 hours
test_ci_debian_buster_on_fedora_latest:
stage: test
tags: [dcma, docker, linux]
needs: ["build_ci_debian_buster"]
image: "fedora:latest"
script:
# Provide minimal system libraries.
- "./scripts/install_AppImage_runtime_dependencies.sh"
# Unpack the AppImage and overlay it in the containers root filesystem.
#- "wget --no-check-certificate 'http://halclark.ca/ci/DICOMautomaton-latest-x86_64.AppImage'"
- "chmod 777 DICOMautomaton*AppImage"
- "./DICOMautomaton*AppImage --appimage-extract"
# Explicitly preload libraries using a wrapper.
- |
printf '%s\n' '#!/usr/bin/env bash' >> /usr/bin/dicomautomaton_dispatcher
#printf '%s $@\n' "LD_LIBRARY_PATH=$(pwd)/squashfs-root/usr/lib $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher" >> /usr/bin/dicomautomaton_dispatcher
printf '%s "$@"\n' "/usr/lib64/ld-linux-x86-64.so.2 --library-path $(pwd)/squashfs-root/usr/lib $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher" >> /usr/bin/dicomautomaton_dispatcher
chmod 777 /usr/bin/dicomautomaton_dispatcher
# Ensure it can be run and then run tests.
- "ldd $(pwd)/squashfs-root/usr/bin/dicomautomaton_dispatcher || true"
- "dicomautomaton_dispatcher -h"
#- "git clone 'https://github.com/hdclark/DICOMautomaton'"
#- "cd DICOMautomaton"
- "./integration_tests/Run.sh -v"
artifacts:
paths:
- "dcma_integration_testing"
expire_in: 55 hours
# Cross-compilation testing.
test_cross_compile_mxe_on_debian_buster:
stage: test
tags: [dcma, docker, linux]
needs: ["cross_compile_mxe"]
image: "debian:buster"
script:
# Provide minimal system libraries.
- "export DEBIAN_FRONTEND='noninteractive'"
- "apt-get update --yes"
- "apt-get install --yes --no-install-recommends git ca-certificates rsync mesa-utils"
- "dpkg --add-architecture i386"
- "apt-get update --yes"
- "apt-get install --yes wine32 wine64"
# Debugging note: to download the latest sources and Windows CI binaries:
#- "apt-get install --yes wget unzip vim"
#- "git clone https://github.com/hdclark/DICOMautomaton && cd DICOMautomaton"
#- "wget 'https://gitlab.com/hdeanclark/DICOMautomaton/builds/artifacts/master/download?job=cross_compile_mxe' -O dcma.zip"
#- "unzip dcma.zip"
# Opt to use the bundled software opengl32.dll, just in case the host doesn't provide any opengl implementation.
- "( cd ./Windows/usr/bin/ && mv opengl32_disabled.dll opengl32.dll ) || true"
# Wrap the Windows binary with wine calls so it is transparent to the caller.
- "chmod 777 Windows/usr/bin/*"
- "rsync -a ./Windows/usr/ /usr/"
- "echo '#!/bin/bash' > /usr/bin/dicomautomaton_dispatcher"
- "echo 'exec wine /usr/bin/dicomautomaton_dispatcher.exe \"$@\"' >> /usr/bin/dicomautomaton_dispatcher"
- "chmod 777 /usr/bin/dicomautomaton_dispatcher"
# Ensure it can be run and then run tests.
- "dicomautomaton_dispatcher -h"
- "./integration_tests/Run.sh -v"
artifacts:
paths:
- "dcma_integration_testing"
expire_in: 55 hours
#######################################################################################################################
### Deployment stages.
#######################################################################################################################
deploy_ci_debian_buster:
stage: deploy
tags: [dcma, docker, linux]
needs: ["test_ci_debian_buster_on_debian_buster"]
script:
- "echo 'Deployment placeholder successful'"