-
Notifications
You must be signed in to change notification settings - Fork 197
/
.gitlab-ci.yml
297 lines (268 loc) · 8.57 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
293
294
295
296
297
variables:
TEST_RUNNER_CONTAINER: ${REGISTRY_HOST}/beckhoff/test_stage/test_runner:v4.69
BHF_CI_TEST_STAGE_GIT_REF: v4.69
image: ${REGISTRY_HOST}/beckhoff/bdpg:master
stages:
- build
- test
- release-push
cache:
paths:
- apt-cache/
codestyle:
stage: build
tags:
- docker
before_script:
- apt update -y && apt install -y uncrustify
- uncrustify -v
script:
- ./tools/run-uncrustify.sh check
rules:
- if: $BHF_CI_SKIP_CODESTYLE == "y"
when: never
- if: $CI_MERGE_REQUEST_ID
when: never
- when: on_success
.build-meson:
stage: build
script:
- meson setup build ${BHF_CI_MESON_OPTIONS}
- ninja -C build
- meson setup example/build example ${BHF_CI_MESON_OPTIONS}
- ninja -C example/build
artifacts:
when: always
paths:
- AdsLib/**/*.h
- build/
- example/build/
.build-meson-docker:
extends: .build-meson
tags:
- docker
build-arch:
extends: .build-meson-docker
image: ${DOCKER_PROXY}archlinux:base-devel
before_script:
- pacman --noconfirm --refresh --sync --sysupgrade meson
build-alpine:
extends: .build-meson-docker
image: ${DOCKER_PROXY}alpine:3.16.2
before_script:
- apk add g++ meson
build-linux-clang:
extends: .build-meson-docker
variables:
CXX: clang++
before_script:
- apt-get update && apt-get --assume-yes install clang meson
build-fbsd-clang:
extends: .build-meson
tags:
- tcbsd
before_script:
- doas pkg install -y meson
# we dont limit grep --max-count=1, because curl would complain if grep closes the pipe
- curl https://tcbsd.beckhoff.com/TCBSD/13/stable/packages/All/ | grep --only-matching -e "href='.*ADS-Comm-Lib.*'" | cut -d "'" -f 2 | xargs -I{} fetch https://tcbsd.beckhoff.com/TCBSD/13/stable/packages/All/{}
- doas pkg install -y -f TF6000-ADS-Comm-Lib-*
variables:
BHF_CI_MESON_OPTIONS: '-Dtcadsdll_include=/usr/local/include -Dtcadsdll_lib=/usr/local/lib'
build-linux-gcc:
extends: .build-meson-docker
parallel:
matrix:
- BHF_CI_ARCH:
- amd64
- arm64
tags:
- "docker_${BHF_CI_ARCH}"
variables:
BHF_CI_MESON_OPTIONS: '-Dtcadsdll_include=/usr/include -Dtcadsdll_lib=/usr/lib'
before_script:
- apt-get update && apt-get --assume-yes install libadscomm-dev meson
build-linux-gcc-i386:
extends: .build-meson-docker
variables:
BHF_CI_MESON_OPTIONS: '--cross-file meson.cross.amd64-linux.i386'
before_script:
- apt-get update && apt-get --assume-yes install libc6-dev-i386 g++-multilib meson
build-linux-gcc-mips:
extends: .build-meson-docker
variables:
BHF_CI_MESON_OPTIONS: '--cross-file meson.cross.amd64-linux.mips'
before_script:
- apt-get update && apt-get --assume-yes install g++-mips-linux-gnu meson
build-linux-gcc-riscv64:
extends: .build-meson-docker
variables:
BHF_CI_MESON_OPTIONS: '--cross-file meson.cross.amd64-linux.riscv64'
before_script:
- apt-get update && apt-get --assume-yes install g++-riscv64-linux-gnu meson
build-mxe:
extends: .build-meson-docker
image: ${REGISTRY_HOST}/beckhoff/docker-mxe:40549
variables:
BHF_CI_MESON_OPTIONS: '--cross-file meson.cross.amd64-linux.win32 -Dcpp_std=c++14 -Db_pie=false'
build-win10:
stage: build
tags:
- MD_VS_GUI_TCPKG_TC
script:
- $env:CI_COMMIT_MESSAGE = $null
- $env:CI_COMMIT_DESCRIPTION = $null
- $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
- $prog_x86 = [System.Environment]::GetFolderPath('ProgramFilesX86'); $vswhere = "${prog_x86}\Microsoft Visual Studio\Installer\vswhere.exe"; $vsInstallPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath; Import-Module "$vsInstallPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell -VsInstallPath:$vsInstallPath -SkipAutomaticLocation -DevCmdArguments:'-arch=x64 -host_arch=x64'
- meson setup build -Dwerror=false -Dcpp_args="-D_CRT_NONSTDC_NO_WARNINGS=1, -D_CRT_SECURE_NO_WARNINGS=1, -DNOMINMAX=1" -Dtcadsdll_include="c:\Program Files (x86)\Beckhoff\TwinCAT\AdsApi\TcAdsDll\Include" -Dtcadsdll_lib="c:\Program Files (x86)\Beckhoff\TwinCAT\AdsApi\TcAdsDll\lib\x64"
- ninja -C build
- meson setup example/build example -Dwerror=false -Dcpp_args="-D_CRT_NONSTDC_NO_WARNINGS=1, -D_CRT_SECURE_NO_WARNINGS=1, -DNOMINMAX=1" -Dtcadsdll_include="c:\Program Files (x86)\Beckhoff\TwinCAT\AdsApi\TcAdsDll\Include" -Dtcadsdll_lib="c:\Program Files (x86)\Beckhoff\TwinCAT\AdsApi\TcAdsDll\lib\x64"
- ninja -C example/build
artifacts:
when: always
paths:
- AdsLib/**/*.h
- build/
- example/build/
build-clangcl:
extends: .build-meson
image: ${REGISTRY_HOST}/beckhoff/docker-clangcl:main
tags:
- docker
variables:
BHF_CI_MESON_OPTIONS: '--cross-file meson.cross.clang-cl.win32 -Dcpp_args=["-D_CRT_NONSTDC_NO_WARNINGS=1","-D_CRT_SECURE_NO_WARNINGS=1","-DNOMINMAX=1"] -Dtcadsdll_include=/opt/TcAdsDll/Include -Dtcadsdll_lib=/opt/TcAdsDll/Lib/x64'
before_script:
- unset CI_COMMIT_MESSAGE
- unset CI_COMMIT_DESCRIPTION
- tcpkg download TwinCAT.XAE.AdsApi -o _packages -y
- unzip _packages/TwinCAT.XAE.AdsApi.*.nupkg -d _packages/nupkg
- msiextract _packages/nupkg/tools/TwinCAT-XAE-AdsApi.msi -C _packages/msi
- mv _packages/msi/Program\ Files/AdsApi/TcAdsDll /opt/TcAdsDll
build-tcpkg:
stage: build
image: ${REGISTRY_HOST}/beckhoff/docker-tcpkg:main
tags:
- docker
needs:
- build-win10
script:
- unset CI_COMMIT_MESSAGE
- unset CI_COMMIT_DESCRIPTION
- xmlstarlet ed -L -u //_:package/_:metadata/_:version -v "$(dpkg-parsechangelog -S Version | tr - .)" TwinCAT.XAE.AdsTool.nuspec
- tcpkg pack TwinCAT.XAE.AdsTool.nuspec
artifacts:
paths:
- "*.nupkg"
.test-with-service-container:
stage: test
image: ${TEST_RUNNER_CONTAINER}
tags:
- docker_vm_runner
- few_vcpus
services:
- name: ${REGISTRY_HOST}/beckhoff/build-linuxum:patrickbr-docker-adslib
alias: ads-server
.test-linux:
extends: .test-with-service-container
script:
- apt update -y && apt install -y socat xxd
- ./tools/90_run_tests.sh
test-linux-clang:
extends: .test-linux
needs: [
"build-linux-clang",
]
test-linux-gcc-amd64:
extends: .test-linux
needs:
- job: build-linux-gcc
parallel:
matrix:
- BHF_CI_ARCH: amd64
test-linux-gcc-i386:
extends: .test-linux
needs: [
"build-linux-gcc-i386",
]
before_script:
- dpkg --add-architecture i386
- apt update -y && apt install -y libc6:i386 libstdc++6:i386
test-linux-gcc-mips:
extends: .test-linux
needs: [
"build-linux-gcc-mips",
]
variables:
QEMU_LD_PREFIX: '/usr/mips-linux-gnu'
QEMU_USER_EMULATION: 'qemu-mips'
before_script:
- apt update -y && apt install -y binfmt-support libstdc++-dev-mips-cross qemu-user-binfmt
test-linux-gcc-riscv64:
extends: .test-linux
needs: [
"build-linux-gcc-riscv64",
]
variables:
QEMU_LD_PREFIX: '/usr/riscv64-linux-gnu'
QEMU_USER_EMULATION: 'qemu-riscv64'
before_script:
- apt update -y && apt install -y binfmt-support libstdc++-dev-riscv64-cross qemu-user-binfmt
test-fbsd-clang:
extends: .test-with-service-container
needs: [
"build-fbsd-clang",
]
script:
- tools/prepare_test_stage.sh
- rackctl-emulate add test-device 200
- test_stage/test_stage.sh --config-dir=.test-stage rackctl --install="$(realpath ./*.iso)" test-device & wait $!
build-debian:
parallel:
matrix:
- BHF_CI_ARCH:
- amd64
- arm64
stage: build
tags:
- "docker_${BHF_CI_ARCH}"
before_script:
- apt-get update && mk-build-deps --install --remove debian/control
script:
- bdpg build
- bdpg push-pipelines ./debian-release/*.deb
artifacts:
expire_in: 1 week
when: always
paths:
- ./debian-release
release-push:
stage: release-push
dependencies:
- build-debian
only:
refs:
- master
script:
- mkdir -p "/root/.ssh"
- printf '%s\n' "Host *" > /root/.ssh/config
- printf '\t%s\n' "StrictHostKeyChecking no" "UserKnownHostsFile /dev/null" >> /root/.ssh/config
- .ci/publish_debian_package.sh
allow_failure: true
tcpkg:
stage: release-push
image: ${REGISTRY_HOST}/beckhoff/docker-tcpkg:main
tags:
- docker
dependencies:
- build-tcpkg
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
parallel:
matrix:
- TCPKG_FEED:
- experimental
- unstable
- testing
- stable
script:
- tcpkg push -k "${TCPKG_PUSH_APIKEY}" -s "${TCPKG_PUSH_URL}/${TCPKG_FEED}" -f