-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
343 lines (315 loc) · 12.2 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
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
variables:
PROJECT_NAME:
value: "opsiscript"
description: "Name of the lazarus project (name of .lpi, without the lpi extension)"
stages:
- init
- build
- test_windows
# - test_linux
# - test_macos
- binaryindex
default:
before_script:
- echo "Execute this command before any 'script:' commands."
workflow:
rules:
- if: $PROJECT_NAME == "opsiscript"
variables:
PROJECT_REPOSITORY_PATH: "opsi-script"
- if: $PROJECT_NAME == "opsi_laz_gui_test"
variables:
PROJECT_REPOSITORY_PATH: "helper/opsi-laz-gui-test"
- if: $PROJECT_NAME == "opsi_client_systray"
variables:
PROJECT_REPOSITORY_PATH: "helper/opsi-client-systray"
#**********************************************#
# Get the binary version from the #
# Lazarus Project file (.lpi). #
# The file format is xml. #
#**********************************************#
get version:
stage: init
tags:
- laz-win10
rules:
- if: ($PROJECT_NAME == "")
when: never
- if: $CI_COMMIT_TAG
when: always
- when: manual
script:
- $LAZ_PROJECT_FILE=Join-Path ${PROJECT_REPOSITORY_PATH}\ "${PROJECT_NAME}.lpi"
- New-Item version.env
- $doc = [XML] (Get-Content -Path $LAZ_PROJECT_FILE)
- $MajorVersionNr = $doc.SelectSingleNode("//MajorVersionNr").Value
- if ($MajorVersionNr -eq $null) {$MajorVersionNr = 0}
- $MinorVersionNr = $doc.SelectSingleNode("//MinorVersionNr").Value
- if ($MinorVersionNr -eq $null) {$MinorVersionNr = 0}
- $RevisionNr = $doc.SelectSingleNode("//RevisionNr").Value
- if ($RevisionNr -eq $null) {$RevisionNr = 0}
- $BuildNr = $doc.SelectSingleNode("//BuildNr").Value
- if ($BuildNr -eq $null) {$BuildNr = 0}
- $BINARY_VERSION = $MajorVersionNr + "." + $MinorVersionNr + "." + $RevisionNr + "." + $BuildNr
- echo $BINARY_VERSION
- Add-Content version.env "BINARY_VERSION=${BINARY_VERSION}"
artifacts:
reports:
dotenv: version.env
#***************************************#
# opsi-script pipline #
#***************************************#
.opsi-script_defaults:
rules:
- if: ($PROJECT_NAME != "opsiscript")
when: never
- if: $CI_COMMIT_TAG
when: always
- when: manual
compile opsi-script windows:
stage: build
tags:
- laz-win10
dependencies:
- get version
rules:
- !reference [.opsi-script_defaults, rules]
script:
- $LAZ_PROJECT_FILE=Join-Path ${PROJECT_REPOSITORY_PATH}\ "${PROJECT_NAME}.lpi"
- echo "$LAZ_PROJECT_FILE"
- C:\lazarus\lazbuild.exe $LAZ_PROJECT_FILE --build-all --build-mode=Release_Win32
- echo "Compiling $PROJECT_NAME for Win64"
- C:\lazarus\lazbuild.exe $LAZ_PROJECT_FILE --build-all --build-mode=Release_Win64
- echo "Code signing opsi-script for windows"
- opsi-dev-tool -l info --signserver-sign $PROJECT_REPOSITORY_PATH\compiler_out\binarys\i386-win32\opsi-script.exe
- opsi-dev-tool -l info --signserver-sign $PROJECT_REPOSITORY_PATH\compiler_out\binarys\x86_64-win64\opsi-script.exe
artifacts:
name: "opsi-script $BINARY_VERSION windows"
paths:
- $PROJECT_REPOSITORY_PATH\compiler_out\binarys\i386-win32\
- $PROJECT_REPOSITORY_PATH\compiler_out\binarys\x86_64-win64\
compile opsi-script linux:
stage: build
tags:
- laz-linux
dependencies:
- get version
rules:
- !reference [.opsi-script_defaults, rules]
script:
- LAZ_PROJECT_FILE=${PROJECT_REPOSITORY_PATH}/${PROJECT_NAME}.lpi
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling $PROJECT_NAME for Linux with no GUI"
- /usr/share/lazarus/3.4.0/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_Lin_64_nogui
- echo "Compiling $PROJECT_NAME for Linux with GUI"
- /usr/share/lazarus/3.4.0/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_Lin_64_gui
# - $BINARY_OUT_PATH = $PROJECT_NAME -eq "opsiscript")
artifacts:
name: "opsi-script $BINARY_VERSION linux"
paths:
- $PROJECT_REPOSITORY_PATH/compiler_out/binarys/x86_64-linux/
compile opsi-script macos:
stage: build
tags:
- laz-macos
dependencies:
- get version
rules:
- !reference [.opsi-script_defaults, rules]
variables:
ENTITLEMENTS: "--entitlements $PROJECT_REPOSITORY_PATH/opsi-script.entitlements" #maybe needed later
script:
#---BUILD BINARIES---
- LAZ_PROJECT_FILE=${PROJECT_REPOSITORY_PATH}/${PROJECT_NAME}.lpi
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling $PROJECT_NAME for MacOS with no GUI"
- /Applications/Lazarus/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_mac_nogui --ws=cocoa
- echo "Compiling $PROJECT_NAME for MacOS with GUI"
- /Applications/Lazarus/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_mac_gui --ws=cocoa
# - $BINARY_OUT_PATH = $PROJECT_NAME -eq "opsiscript")
artifacts:
name: "opsi-script $BINARY_VERSION macos"
paths:
- $PROJECT_REPOSITORY_PATH/compiler_out/binarys/x86_64-darwin/
opsi-script-test windows:
stage: test_windows
tags:
- laz-windows
variables:
PROJECT_REPOSITORY_PATH: "opsi-script"
rules:
- if: ($PROJECT_NAME == "opsiscript") && ($PLATFORM == "all" || $PLATFORM == "Windows")
when: never # change to always if job script/rules are their
script:
- echo "opsi-script-test on windows"
- cp $PROJECT_REPOSITORY_PATH\compiler_out\binarys\i386-win32\opsi-script.exe %SystemDrive%\%ProgramFiles(x86)%\opsi.org\opsi-client-agent\opsi-script\opsi-script.exe
- cp $PROJECT_REPOSITORY_PATH\compiler_out\binarys\i386-win32\opsi-script.exe %SystemDrive%\%ProgramFiles(x86)%\opsi.org\opsi-client-agent\opsi-script\winst32.exe
#- C:\"Program Files (x86)"\opsi.org\opsi-client-agent\opsi-script\opsi-script.exe $PROJECT_REPOSITORY_PATH\ci_cd_opsi-script-test.opsiscript /silent
- C:\"Program Files (x86)"\opsi.org\opsi-client-agent\opsi-script\opsi-script.exe $PROJECT_REPOSITORY_PATH\ci_cd_opsi-script-test.opsiscript /batch /opsiservice $OPSISERVICEURL /clientid $LAZ_WINDOWS /username $LAZ_WINDOWS /password $PASSWORD_LAZ_WINDOWS
#- ssh [email protected] #work this out
#- opsi-admin -d fire_Event OnDemand opsi-script-test setup # work this out
#- git clone opsi-script-test
opsi-script to binaryindex:
stage: binaryindex
tags:
- laz-linux
dependencies:
- get version
- compile opsi-script windows
- compile opsi-script linux
- compile opsi-script macos
rules:
- !reference [.opsi-script_defaults, rules]
script:
- echo "deploy to binaryindex"
- rm -rf upload
- cd opsi-script
- opsi-dev-tool -l info --binary-pull
- cp compiler_out/binarys/i386-win32/opsi-script.exe upload/win32/opsi-script
- cp upload/win32/opsi-script/opsi-script.exe upload/win32/opsi-script/winst32.exe
- cp compiler_out/binarys/x86_64-win64/opsi-script.exe upload/win64/opsi-script
- cp upload/win64/opsi-script/opsi-script.exe upload/win64/opsi-script/winst64.exe
- cp compiler_out/binarys/x86_64-linux/opsi-script upload/lin64/opsi-script
- cp compiler_out/binarys/x86_64-linux/opsi-script-gui upload/lin64/opsi-script
- cp compiler_out/binarys/x86_64-darwin/opsi-script upload/mac64/opsi-script
- cp compiler_out/binarys/x86_64-darwin/opsi-script-gui upload/mac64/opsi-script
- ls -lah upload/*/opsi-script
- echo "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push upload/win32/opsi-script opsi-script-bin windows x86 "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push upload/win64/opsi-script opsi-script-bin windows x64 "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push upload/lin64/opsi-script opsi-script-bin linux x64 "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push upload/mac64/opsi-script opsi-script-bin darwin x64 "${BINARY_VERSION}"
#*********************************
# opsi-laz-gui-test
#*********************************
.opsi-laz-gui-test_defaults:
rules:
- if: ($PROJECT_NAME != "opsi_laz_gui_test")
when: never
- if: $CI_COMMIT_TAG
when: always
- when: manual
compile opsi-laz-gui-test linux:
stage: build
tags:
- laz-linux
dependencies:
- get version
rules:
- !reference [.opsi-laz-gui-test_defaults, rules]
script:
- LAZ_PROJECT_FILE=${PROJECT_REPOSITORY_PATH}/opsi_laz_gui_test.lpi
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling opsi-laz-gui-testE for Linux"
- /usr/bin/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release
# - $BINARY_OUT_PATH = $PROJECT_NAME -eq "opsiscript")
artifacts:
name: "opsi-laz-gui-test $BINARY_VERSION linux"
paths:
- $PROJECT_REPOSITORY_PATH/binarys/linux/opsi-laz-gui-test
compile opsi-laz-gui-test macos:
stage: build
tags:
- laz-macos
dependencies:
- get version
rules:
- !reference [.opsi-laz-gui-test_defaults, rules]
script:
#---BUILD BINARIES---
- LAZ_PROJECT_FILE=${PROJECT_REPOSITORY_PATH}/${PROJECT_NAME}.lpi
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling $PROJECT_NAME for MacOS"
- /Library/Lazarus/lazbuild $LAZ_PROJECT_FILE --build-all --build-mode=Release_mac --ws=cocoa
# - $BINARY_OUT_PATH = $PROJECT_NAME -eq "opsiscript")
artifacts:
name: "opsi-laz-gui-test $BINARY_VERSION macos"
paths:
- $PROJECT_REPOSITORY_PATH/binarys/mac/opsi-laz-gui-test
opsi-laz-gui-test to binaryindex:
stage: binaryindex
tags:
- laz-linux
dependencies:
- get version
rules:
- !reference [.opsi-laz-gui-test_defaults, rules]
script:
- echo "deploy to binaryindex"
- cd helper/opsi-laz-gui-test
- opsi-dev-tool -l info --binary-push binarys/linux/opsi-laz-gui-test opsi-laz-gui-test linux x64 "${BINARY_VERSION}"
- opsi-dev-tool -l info --binary-push binarys/mac/opsi-laz-gui-test opsi-laz-gui-test darwin x64 "${BINARY_VERSION}"
#***************************************#
# opsi-client-systray pipline #
#***************************************#
.opsi-client-systray_defaults:
rules:
- if: ($PROJECT_NAME != "opsi_client_systray")
when: never
- if: $CI_COMMIT_TAG
when: always
- when: manual
compile opsi-client-systray windows:
stage: build
tags:
- laz-win10
dependencies:
- get version
variables:
BINARY_NAME: "opsi-client-systray"
rules:
- !reference [.opsi-client-systray_defaults, rules]
script:
- $LAZ_PROJECT_FILE=Join-Path ${PROJECT_REPOSITORY_PATH}\ "${PROJECT_NAME}.lpi"
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling $PROJECT_NAME for Win32"
- C:\lazarus\lazbuild.exe $LAZ_PROJECT_FILE --build-mode=Release_Win32
- echo "Compiling $PROJECT_NAME for Win64"
- C:\lazarus\lazbuild.exe $LAZ_PROJECT_FILE --build-mode=Release_Win64
artifacts:
name: "$BINARY_NAME $BINARY_VERSION windows"
paths:
- $PROJECT_REPOSITORY_PATH\$BINARY_NAME
compile opsi-client-systray linux:
stage: build
tags:
- laz-linux
dependencies:
- get version
variables:
BINARY_NAME: "opsi-client-systray"
rules:
- !reference [.opsi-client-systray_defaults, rules]
script:
- LAZ_PROJECT_FILE=${PROJECT_REPOSITORY_PATH}/${PROJECT_NAME}.lpi
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling $PROJECT_NAME for Linux with no GUI"
- /usr/bin/lazbuild $LAZ_PROJECT_FILE --build-mode=Release_Lin_64_nogui
- echo "Compiling $PROJECT_NAME for Linux with GUI"
- /usr/bin/lazbuild $LAZ_PROJECT_FILE --build-mode=Release_Lin_64_gui
artifacts:
name: "$BINARY_NAME $BINARY_VERSION linux"
paths:
- $PROJECT_REPOSITORY_PATH/$BINARY_NAME
compile opsi-client-systray macos:
stage: build
tags:
- laz-macos
dependencies:
- get version
variables:
BINARY_NAME: "opsi-client-systray"
rules:
- !reference [.opsi-client-systray_defaults, rules]
script:
- LAZ_PROJECT_FILE=${PROJECT_REPOSITORY_PATH}${PROJECT_NAME}.lpi
- echo "$LAZ_PROJECT_FILE"
- echo "Compiling $PROJECT_NAME for MacOS with no GUI"
- /Applications/Lazarus/lazbuild $LAZ_PROJECT_FILE --build-mode=Release_mac_nogui --ws=cocoa
- echo "Compiling $PROJECT_NAME for MacOS with GUI"
- /Applications/Lazarus/lazbuild $LAZ_PROJECT_FILE --build-mode=Release_mac_gui --ws=cocoa
# - $BINARY_OUT_PATH = $PROJECT_NAME -eq "opsiscript")
artifacts:
name: "$BINARY_NAME $BINARY_VERSION macos"
paths:
- $PROJECT_REPOSITORY_PATH/$BINARY_NAME