-
Notifications
You must be signed in to change notification settings - Fork 22
/
.gitlab-ci.yml
577 lines (547 loc) · 26.5 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
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
stages:
- build
- test
- package
- publish
default:
interruptible: true
.cache:
variables:
CCACHE_DIR: "$CI_PROJECT_DIR/.ccache"
CCACHE_MAXSIZE: "100M"
cache:
key: "$CI_JOB_STAGE:$CI_JOB_NAME"
paths: [.ccache]
# ----------- Build MiniZincIDE -----------
build:linux:
extends: .cache
stage: build
image: ghcr.io/minizinc/docker-build-environment:qt
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_STRATEGY: clone
DISABLE_COPYRIGHT_FILES_DEPLOYMENT: '1'
DEBUG: '1'
script:
- mkdir -p build; cd build
- qmake -makefile "CONFIG+=bundled" "CXX_PREFIX=ccache" "DEFINES+=MINIZINC_IDE_BUILD=\\\\\\\"\"${CI_PIPELINE_ID}\\\\\\\"\"" PREFIX=/usr ../MiniZincIDE/MiniZincIDE.pro
- make -j4
- make -j4 INSTALL_ROOT=../ide install; find ../ide/
- cd ..
# Download Gecode Gist so linuxdeploy can include its dependencies
- curl --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" --silent https://gitlab.com/api/v4/snippets/1796163/raw | tr -d '\r' > download.sh
- sh download.sh minizinc-vendor master gecode_gist:linux vendor.zip
- unzip -q vendor.zip
- linuxdeploy --appdir ide --executable vendor/gecode_gist/bin/fzn-gecode --plugin qt -v0
- rm -rf ide/usr/share ide/usr/translations ide/usr/bin/fzn-gecode
tags: [linux, docker]
artifacts:
paths: [ide/]
build:osx:
extends: .cache
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_STRATEGY: clone
script:
- mkdir -p build; cd build
- qmake -makefile "CONFIG+=bundled" "CXX_PREFIX=ccache" "DEFINES+=MINIZINC_IDE_BUILD=\\\\\\\"\"${CI_PIPELINE_ID}\\\\\\\"\"" QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64" ../MiniZincIDE/MiniZincIDE.pro
- make -j4
- cp -r MiniZincIDE.app ..
tags: [osx, cpp, qt]
artifacts:
paths: [MiniZincIDE.app]
build:win64:
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
MZNARCH: "win64"
BUILDCACHE_DIR: "$CI_PROJECT_DIR/.ccache"
BUILDCACHE_MAX_CACHE_SIZE: "104857600"
script:
- if not exist "build" mkdir build
- if not exist "ide" mkdir ide
- cd build
- qmake "CONFIG+=bundled" "CXX_PREFIX=buildcache" "DEFINES+=MINIZINC_IDE_BUILD=\\\\\\\"\"%CI_PIPELINE_ID%\\\\\\\"\"" ../MiniZincIDE/MiniZincIDE.pro
- jom -j4
- cp release/MiniZincIDE.exe ../ide
- cd ../
# Download Gecode Gist so windeployqt can include its dependencies
- curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fminizinc-vendor/jobs/artifacts/master/download?job=gecode_gist:%MZNARCH%"
- unzip -q vendor.zip
- cd ide
- windeployqt --no-translations --no-compiler-runtime --no-system-d3d-compiler MiniZincIDE.exe ../vendor/gecode_gist/bin/fzn-gecode.exe
tags: [win64, cpp, qt]
artifacts:
paths: [ide/]
cache:
key: "build_win64"
paths: [.ccache]
# ----------- Test MiniZincIDE -----------
.tests_template:
image: ghcr.io/minizinc/docker-build-environment:qt
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_STRATEGY: clone
QT_QPA_PLATFORM: offscreen
MZN_SOLVER_PATH: ${CI_PROJECT_DIR}/vendor/gecode/share/minizinc/solvers/:${CI_PROJECT_DIR}/vendor/chuffed/share/minizinc/solvers
before_script:
- 'if [ -n "$CI_COMMIT_TAG" ]; then MZNREF="$CI_COMMIT_TAG"; elif [ "$CI_COMMIT_REF_NAME" = "master" ]; then MZNREF="master"; else MZNREF="develop"; fi'
### Download Dependencies
- curl --silent -o minizinc.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc/jobs/artifacts/$MZNREF/download?job=build:$MZNARCH"
- unzip -q minizinc.zip
- curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc-vendor/jobs/artifacts/master/download?job=bundle:$MZNARCH"
- unzip -q vendor.zip
### Add MiniZinc to path
- export PATH=$CI_PROJECT_DIR/minizinc/bin:$PATH
script:
### Build tests
- mkdir -p test; cd test
- qmake -makefile "CXX_PREFIX=ccache" ../tests/tests.pro
- make -j4
### Run tests
- make check
needs: []
test:linux:
extends: [.cache, .tests_template]
variables:
MZNARCH: linux
tags: [linux, docker]
test:osx:
extends: [.cache, .tests_template]
variables:
MZNARCH: osx
tags: [osx, cpp, qt]
test:win64:
extends: [.cache, .tests_template]
variables:
MZNARCH: win64
MZN_SOLVER_PATH: ${CI_PROJECT_DIR}/vendor/gecode/share/minizinc/solvers/;${CI_PROJECT_DIR}/vendor/chuffed/share/minizinc/solvers
BUILDCACHE_DIR: "$CI_PROJECT_DIR/.ccache"
BUILDCACHE_MAX_CACHE_SIZE: "104857600"
before_script:
### Choose the MiniZinc compiler branch
- if defined CI_COMMIT_TAG (set MZNREF=%CI_COMMIT_TAG%) else if %CI_COMMIT_REF_NAME%==master (set MZNREF=master) else (set MZNREF=develop)
### Download Dependencies
- curl --silent -o minizinc.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fminizinc/jobs/artifacts/%MZNREF%/download?job=build:%MZNARCH%"
- unzip -q minizinc.zip
- curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fminizinc-vendor/jobs/artifacts/master/download?job=bundle:%MZNARCH%"
- unzip -q vendor.zip
### Add MiniZinc to path
- set PATH=%CI_PROJECT_DIR%/minizinc/bin;%PATH%
script:
### Build tests
- if not exist "test" mkdir test
- cd test
- qmake "CXX_PREFIX=buildcache" ../tests/tests.pro
- jom -j4
### Run tests
- jom check
tags: [win64, cpp, qt]
cache:
key: "test_win64"
paths: [.ccache]
# ----------- MiniZinc Packaging -----------
.packaging_setup: &packaging_setup
before_script:
### Set the MZNVERSION variable
- 'if [ -n "$CI_COMMIT_TAG" ]; then MZNVERSION="$CI_COMMIT_TAG"; else MZNVERSION="build$CI_PIPELINE_ID"; fi'
### Choose the MiniZinc compiler branch
- 'if [ -n "$CI_COMMIT_TAG" ]; then MZNREF="$CI_COMMIT_TAG"; elif [ "$CI_COMMIT_REF_NAME" = "master" ]; then MZNREF="master"; else MZNREF="develop"; fi'
### Choose the FindMUS branch
- 'if [ -n "$CI_COMMIT_TAG" ] || [ "$CI_COMMIT_REF_NAME" = "master" ]; then FINDMUSREF="master"; else FINDMUSREF="develop"; fi'
### Choose the FindMUS branch
- 'if [ -n "$CI_COMMIT_TAG" ] || [ "$CI_COMMIT_REF_NAME" = "master" ]; then ANALYSEREF="master"; else ANALYSEREF="develop"; fi'
### Download Dependencies
- curl --silent -o minizinc.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc/jobs/artifacts/$MZNREF/download?job=build:$MZNARCH"
- unzip -q minizinc.zip
- '[ ${DOWNLOAD_SOLVERS:-1} -eq 1 ] && curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc-vendor/jobs/artifacts/master/download?job=bundle:$MZNARCH" && unzip -q vendor.zip'
- '[ ${DOWNLOAD_GLOBALIZER:-0} -eq 1 ] && curl --silent -o globalizer.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2FGlobalizer/jobs/artifacts/master/download?job=build:$MZNARCH" && unzip -q globalizer.zip'
- '[ ${DOWNLOAD_FINDMUS:-0} -eq 1 ] && curl --silent -o findmus.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2FFindMUS/jobs/artifacts/$FINDMUSREF/download?job=build:$MZNARCH" && unzip -q findmus.zip'
- '[ ${DOWNLOAD_ANALYSE:-0} -eq 1 ] && curl --silent -o mzn-analyse.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fmzn-analyse/jobs/artifacts/$ANALYSEREF/download?job=build:$MZNARCH" && unzip -q mzn-analyse.zip'
package:check_version:
stage: package
image: ghcr.io/minizinc/docker-build-environment:qt
variables:
MZNARCH: "linux"
DOWNLOAD_SOLVERS: 0
<<: *packaging_setup
script:
- mkdir -p build; cd build
- qmake -makefile "CONFIG+=output_version" ../MiniZincIDE/MiniZincIDE.pro
- IDE_VERSION=$(tr -s ' ' < version)
- MZN_VERSION=$(../minizinc/bin/minizinc --version | grep -Po '(?<=version )[^,]+')
- echo IDE is version ${IDE_VERSION}
- echo MiniZinc is version ${MZN_VERSION}
- if [ "$IDE_VERSION" != "$MZN_VERSION" ]; then echo 'Version mismatch!'; exit 1; fi
- if [ -n "$CI_COMMIT_TAG" ]; then echo Tag is "$CI_COMMIT_TAG"; if [ "$CI_COMMIT_TAG" != "$MZN_VERSION" ]; then echo 'Version mismatch!'; exit 1; fi; fi
needs: []
tags: [linux, docker]
package:linux:
stage: package
image: ghcr.io/minizinc/docker-build-environment:package
variables:
MZNARCH: "linux"
DOWNLOAD_GLOBALIZER: 1
DOWNLOAD_FINDMUS: 1
DOWNLOAD_ANALYSE: 1
<<: *packaging_setup
script:
- PACKAGE=MiniZincIDE-${MZNVERSION}-bundle-linux-x86_64
- mkdir -p $PACKAGE/lib/
### Package IDE
- mv ide/usr/* $PACKAGE/
- cp resources/scripts/MiniZincIDE.sh $PACKAGE/
### Package MiniZinc
- mv minizinc/bin/* $PACKAGE/bin/
- mv minizinc/share $PACKAGE/share
### Package vendor solvers
- mv vendor/gecode_gist/bin/fzn-gecode $PACKAGE/bin/
- patchelf --set-rpath '$ORIGIN/../lib' $PACKAGE/bin/fzn-gecode
- cp -r vendor/gecode_gist/share/minizinc/* $PACKAGE/share/minizinc/
- mv vendor/chuffed/bin/fzn-chuffed $PACKAGE/bin/
- cp -r vendor/chuffed/share/minizinc/* $PACKAGE/share/minizinc/
- mv vendor/or-tools/bin/fzn-cp-sat $PACKAGE/bin/
- cp -r vendor/or-tools/share/minizinc/* $PACKAGE/share/minizinc/
- cp vendor/highs/lib64/libhighs.so $PACKAGE/lib/
### Package Globalizer
- mv globalizer/bin/minizinc-globalizer $PACKAGE/bin/
- cp -r globalizer/share/minizinc/* $PACKAGE/share/minizinc/
### Package findMUS
- mv findMUS/bin/findMUS $PACKAGE/bin/
- cp -r findMUS/share/minizinc/* $PACKAGE/share/minizinc/
### Package mzn-analyse
- mv mzn-analyse/bin/mzn-analyse $PACKAGE/bin/
### Strip included binaries
- (cd $PACKAGE/bin; strip minizinc fzn-gecode fzn-chuffed fzn-cp-sat findMUS mzn-analyse minizinc-globalizer mzn2doc)
- cp resources/misc/README $PACKAGE
### Compress package
- tar -czf $PACKAGE.tgz $PACKAGE
### Generate checksum
- sha256sum $PACKAGE.tgz > $PACKAGE.sha256
artifacts:
name: "minizinc_bundle_linux_${CI_PIPELINE_ID}"
paths: [MiniZincIDE*.tgz, MiniZincIDE*.sha256]
needs: ["build:linux"]
tags: [linux, docker]
package:osx:
stage: package
variables:
MZNARCH: "osx"
DOWNLOAD_GLOBALIZER: 1
DOWNLOAD_FINDMUS: 1
DOWNLOAD_ANALYSE: 1
<<: *packaging_setup
script:
- "DIR=MiniZincIDE.app/Contents/Resources; MZNDIR=$DIR/share/minizinc"
- mkdir -p $MZNDIR/solvers
### Package MiniZinc
- mv minizinc/bin/* $DIR/
- mv minizinc/share/minizinc/* $MZNDIR/
### Package vendor solvers
- mkdir -p $DIR/bin/
- mkdir -p $DIR/lib/
- mv vendor/gecode_gist/bin/fzn-gecode $DIR/bin/fzn-gecode
- cp -r vendor/gecode_gist/share/minizinc/* $MZNDIR/
- cp resources/misc/osx-gecode-qt.conf $DIR/bin/qt.conf
- mv vendor/chuffed/bin/fzn-chuffed $DIR/bin/
- cp -r vendor/chuffed/share/minizinc/* $MZNDIR/
- mv vendor/or-tools/bin/fzn-cp-sat $DIR/bin/
- cp -r vendor/or-tools/share/minizinc/* $MZNDIR/
- cp vendor/highs/lib/libhighs.dylib $DIR/lib/
### Package Globalizer
- mv globalizer/bin/minizinc-globalizer $DIR/bin/
- cp -r globalizer/share/minizinc/* $MZNDIR/
### Package findMUS
- mv findMUS/bin/findMUS $DIR/bin/
- cp -r findMUS/share/minizinc/* $MZNDIR/
### Package mzn-analyse
- mv mzn-analyse/bin/mzn-analyse $DIR/bin/
### Strip included binaries
- (cd $DIR; strip minizinc mzn2doc)
- (cd $DIR/bin; strip fzn-gecode fzn-chuffed fzn-cp-sat findMUS mzn-analyse minizinc-globalizer)
### Run automated Qt deployment tool
- macdeployqt ./MiniZincIDE.app -executable=$DIR/bin/fzn-gecode
### Sign package
- if [ -z "$OSX_DEVELOPER_ID" ]; then
- exit 0
- fi
- security unlock-keychain -p "$OSX_KEYCHAIN_PASSWORD" "$OSX_KEYCHAIN_PATH"
- security set-key-partition-list -S 'apple-tool:,apple:' -s -k "$OSX_KEYCHAIN_PASSWORD" "$OSX_KEYCHAIN_PATH"
- security list-keychains -d user -s "$OSX_KEYCHAIN_PATH" login.keychain
- for f in MiniZincIDE.app/Contents/Frameworks/*.framework; do \
- codesign --options runtime --force --sign "$OSX_DEVELOPER_ID" $f/Versions/*/`basename $f .framework`; \
- done
- find MiniZincIDE.app/Contents/PlugIns MiniZincIDE.app/Contents/Frameworks -type f -name '*.dylib' -exec codesign --options runtime --force --sign "$OSX_DEVELOPER_ID" {} \;
- find MiniZincIDE.app/Contents/Resources -type f -perm +111 -exec codesign --options runtime --entitlements resources/misc/entitlements.xml --force --sign "$OSX_DEVELOPER_ID" {} \;
- codesign --options runtime --force --sign "$OSX_DEVELOPER_ID" MiniZincIDE.app
- ditto -c -k --sequesterRsrc --keepParent MiniZincIDE.app signed_bundle.zip
- xcrun notarytool submit signed_bundle.zip --team-id "$OSX_NOTARY_TOOL_TEAM_ID" --apple-id "$OSX_NOTARY_TOOL_APPLE_ID" --password "$OSX_NOTARY_TOOL_PASSWORD" --wait
- xcrun stapler staple MiniZincIDE.app
- cp "$OSX_TEMPLATE_IMAGE" signed_bundle.sparseimage
- hdiutil detach -quiet signed_bundle || true
- hdiutil attach -mountpoint signed_bundle signed_bundle.sparseimage
- diskutil rename signed_bundle "MiniZinc IDE $MZNVERSION (bundled)"
- rm -rf signed_bundle/MiniZincIDE.app
- mv MiniZincIDE.app signed_bundle/
- hdiutil detach signed_bundle
- hdiutil convert -format UDZO -o MiniZincIDE-$MZNVERSION-bundled.dmg signed_bundle.sparseimage
after_script:
- hdiutil detach -quiet signed_bundle || true
- security lock-keychain "$OSX_KEYCHAIN_PATH"
artifacts:
name: "minizinc_bundle_mac_${CI_PIPELINE_ID}"
paths: [MiniZincIDE.app, MiniZincIDE-*-bundled.dmg]
needs: ["build:osx"]
tags: [osx, qt]
package:osx:ide_only:
stage: package
variables:
MZNARCH: "osx"
script:
### Run automated Qt deployment tool
- macdeployqt ./MiniZincIDE.app
artifacts:
name: "minizinc_ide_mac_${CI_PIPELINE_ID}"
paths: [MiniZincIDE.app]
needs: ["build:osx"]
tags: [osx, qt]
package:win64:
stage: package
variables:
MZNARCH: "win64"
ISSARCH: "x64"
ISSARCHALLOWED: "x64"
before_script:
### Set redist variables
- for /d %%a in ("%VCToolsRedistDir%\\x64\\*.CRT") do set MSVCREDIST=%%a
- set UCRTREDIST=%WindowsSdkDir%\Redist\ucrt\DLLs\x64
### Set the MZNVERSION variable
- if defined CI_COMMIT_TAG (set MZNVERSION=%CI_COMMIT_TAG%) else (set MZNVERSION=%CI_PIPELINE_ID%)
### Choose the MiniZinc compiler branch
- if defined CI_COMMIT_TAG (set MZNREF=%CI_COMMIT_TAG%) else if %CI_COMMIT_REF_NAME%==master (set MZNREF=master) else (set MZNREF=develop)
- if defined CI_COMMIT_TAG (set FINDMUSREF=master) else if %CI_COMMIT_REF_NAME%==master (set FINDMUSREF=master) else (set FINDMUSREF=develop)
- if defined CI_COMMIT_TAG (set ANALYSEREF=master) else if %CI_COMMIT_REF_NAME%==master (set ANALYSEREF=master) else (set ANALYSEREF=develop)
### Download Dependencies
- curl --silent -o minizinc.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fminizinc/jobs/artifacts/%MZNREF%/download?job=build:%MZNARCH%"
- unzip -q minizinc.zip
- curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fminizinc-vendor/jobs/artifacts/master/download?job=bundle:%MZNARCH%"
- unzip -q vendor.zip
- curl --silent -o globalizer.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fglobalizer/jobs/artifacts/master/download?job=build:%MZNARCH%"
- unzip -q globalizer.zip
- curl --silent -o findmus.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2FFindMus/jobs/artifacts/%FINDMUSREF%/download?job=build:%MZNARCH%"
- unzip -q findmus.zip
- curl --silent -o mzn-analyse.zip --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" "https://gitlab.com/api/v4/projects/minizinc%%2Fmzn-analyse/jobs/artifacts/%ANALYSEREF%/download?job=build:%MZNARCH%"
- unzip -q mzn-analyse.zip
script:
- '"C:/Program Files (x86)/Inno Setup 6/ISCC.exe" /dMyAppVersion="%MZNVERSION%" /dMyMZNVersion="%MZNVERSION%" /dMyAppDirectory="%CI_PROJECT_DIR%" /dMyMSVCRedist="%MSVCREDIST%" /dMyUCRTRedist="%UCRTREDIST%" /dMyAPPArch="%MZNARCH%" /dMyApp64Bit="%ISSARCH%" /dMyAppArchitectures="%ISSARCHALLOWED%" /O"%CI_PROJECT_DIR%" resources/pkg_config/minizinc-bundle.iss'
### Generate checksum
- certutil -hashfile MiniZincIDE-%MZNVERSION%-bundled-setup-%MZNARCH%.exe SHA256 > MiniZincIDE-%MZNVERSION%-bundled-setup-%MZNARCH%.sha256
artifacts:
name: "minizinc_bundle_windows_%CI_PIPELINE_ID%"
paths: [MiniZincIDE*.exe, MiniZincIDE*.sha256]
needs: ["build:win64"]
tags: [win64]
package:appimage:
stage: package
image: ghcr.io/minizinc/docker-build-environment:qt
variables:
MZNARCH: "linux"
DOWNLOAD_GLOBALIZER: 1
DOWNLOAD_FINDMUS: 1
DOWNLOAD_ANALYSE: 1
PACKAGE: "MiniZinc.AppDir"
<<: *packaging_setup
script:
- mkdir -p $PACKAGE/usr/lib
### Package IDE
- mv ide/usr/* $PACKAGE/usr/
### Package MiniZinc
- mv minizinc/bin/* $PACKAGE/usr/bin/
- mv minizinc/share $PACKAGE/usr/share
### Package vendor solvers
- mv vendor/gecode_gist/bin/fzn-gecode $PACKAGE/usr/bin/
- cp -r vendor/gecode_gist/share/minizinc/* $PACKAGE/usr/share/minizinc/
- mv vendor/chuffed/bin/fzn-chuffed $PACKAGE/usr/bin/
- cp -r vendor/chuffed/share/minizinc/* $PACKAGE/usr/share/minizinc/
- mv vendor/or-tools/bin/fzn-cp-sat $PACKAGE/usr/bin/
- cp -r vendor/or-tools/share/minizinc/* $PACKAGE/usr/share/minizinc/
- cp vendor/highs/lib64/libhighs.so $PACKAGE/usr/lib/
### Package Globalizer
- mv globalizer/bin/minizinc-globalizer $PACKAGE/usr/bin/
- cp -r globalizer/share/minizinc/* $PACKAGE/usr/share/minizinc/
### Package findMUS
- mv findMUS/bin/findMUS $PACKAGE/usr/bin/
- cp -r findMUS/share/minizinc/* $PACKAGE/usr/share/minizinc/
### Package mzn-analyse
- mv mzn-analyse/bin/mzn-analyse $PACKAGE/usr/bin/
### Strip included binaries
- (cd $PACKAGE/usr/bin; strip minizinc fzn-gecode fzn-chuffed fzn-cp-sat findMUS mzn-analyse minizinc-globalizer mzn2doc)
- cp resources/misc/README $PACKAGE
### Assemble AppImage
- cp resources/scripts/AppRun $PACKAGE
- cp resources/misc/minizinc.desktop $PACKAGE/minizinc.desktop
- cp resources/icon.png $PACKAGE/minizinc.png
- ARCH=x86_64 appimagetool $PACKAGE MiniZincIDE-${MZNVERSION}-x86_64.AppImage
### Generate checksum
- sha256sum MiniZincIDE*.AppImage > MiniZincIDE-${MZNVERSION}-x86_64.sha256
artifacts:
name: "minizinc_appimage_${CI_PIPELINE_ID}"
paths: [MiniZincIDE*.AppImage, MiniZincIDE*.sha256]
needs: ["build:linux"]
tags: [linux, docker]
.docker_setup: &docker_setup
image: ghcr.io/minizinc/docker-build-environment:docker-cli
before_script:
### Set the MZNVERSION variable
- 'if [ -n "$CI_COMMIT_TAG" ]; then MZNVERSION="$CI_COMMIT_TAG"; else MZNVERSION="build$CI_PIPELINE_ID"; fi'
### Choose the MiniZinc compiler branch
- 'if [ -n "$CI_COMMIT_TAG" ]; then MZNREF="$CI_COMMIT_TAG"; elif [ "$CI_COMMIT_REF_NAME" = "master" ]; then MZNREF="master"; else MZNREF="develop"; fi'
### Download Dependencies
- mkdir -p linux/amd64 && cd linux/amd64
- curl --silent -o minizinc.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc/jobs/artifacts/$MZNREF/download?job=build:$MZNARCH" && unzip -q minizinc.zip
- curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc-vendor/jobs/artifacts/master/download?job=bundle:$MZNARCH" && unzip -q vendor.zip
- mkdir -p ../arm64 && cd ../arm64
- curl --silent -o minizinc.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc/jobs/artifacts/$MZNREF/download?job=build:$MZNARCH-arm64" && unzip -q minizinc.zip
- curl --silent -o vendor.zip --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/minizinc%2Fminizinc-vendor/jobs/artifacts/master/download?job=bundle:$MZNARCH-arm64" && unzip -q vendor.zip
- cd ../../
package:docker_alpine:
stage: package
variables:
MZNARCH: "musl"
<<: *docker_setup
script:
- echo "Building image based on \"alpine:latest\" with tag extension \"-alpine\""
- if [ -n "$CI_COMMIT_TAG" ]; then IMAGE_TAG="minizinc/minizinc:${CI_COMMIT_TAG}-alpine"; fi
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then IMAGE_TAG=minizinc/minizinc:latest-alpine; fi
- if [ "$CI_COMMIT_REF_NAME" = "develop" ]; then IMAGE_TAG=minizinc/minizinc:edge-alpine; fi
- if [ -n "$IMAGE_TAG" ]; then BUILDX_ARGS="--push -t $IMAGE_TAG"; fi
- docker buildx build $BUILDX_ARGS --pull --builder=container --platform=linux/amd64,linux/arm64 -f resources/pkg_config/Dockerfile --build-arg BASE='alpine:latest' .
needs: []
tags: [linux-arm64, mac-mini]
package:docker_ubuntu:
stage: package
parallel: 3
variables:
MZNARCH: "linux"
<<: *docker_setup
script:
- BASES=("null" "ubuntu:latest" "ubuntu:jammy" "ubuntu:focal")
- EXTS=("null" "" "-jammy" "-focal")
- echo "Building image based on \"${BASES[$CI_NODE_INDEX]}\" with tag extension \"${EXTS[$CI_NODE_INDEX]}\""
- if [ -n "$CI_COMMIT_TAG" ]; then IMAGE_TAG=minizinc/minizinc:${CI_COMMIT_TAG}${EXTS[$CI_NODE_INDEX]}; fi
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then IMAGE_TAG=minizinc/minizinc:latest${EXTS[$CI_NODE_INDEX]}; fi
- if [ "$CI_COMMIT_REF_NAME" = "develop" ]; then IMAGE_TAG=minizinc/minizinc:edge${EXTS[$CI_NODE_INDEX]}; fi
- if [ -n "$IMAGE_TAG" ]; then BUILDX_ARGS="--push -t $IMAGE_TAG"; fi
- docker buildx build $BUILDX_ARGS --pull --builder=container --platform=linux/amd64,linux/arm64 -f resources/pkg_config/Dockerfile --build-arg BASE=${BASES[$CI_NODE_INDEX]} .
needs: []
tags: [linux-arm64, mac-mini]
minizinc:linux:nogui:
image: ghcr.io/minizinc/docker-build-environment:package
stage: package
variables:
MZNARCH: "linux"
<<: *packaging_setup
script:
- PACKAGE=MiniZinc-${MZNVERSION}-linux-x86_64
- mkdir -p $PACKAGE/bin
- mkdir -p $PACKAGE/lib
### Package MiniZinc
- mv minizinc/bin/* $PACKAGE/bin/
- mv minizinc/share $PACKAGE/share
### Package vendor solvers
- mv vendor/gecode/bin/fzn-gecode $PACKAGE/bin/
- cp -r vendor/gecode/share/minizinc/* $PACKAGE/share/minizinc/
- mv vendor/chuffed/bin/fzn-chuffed $PACKAGE/bin/
- cp -r vendor/chuffed/share/minizinc/* $PACKAGE/share/minizinc/
- mv vendor/or-tools/bin/fzn-cp-sat $PACKAGE/bin/
- cp -r vendor/or-tools/share/minizinc/* $PACKAGE/share/minizinc/
- cp vendor/highs/lib64/libhighs.so $PACKAGE/lib/
### Strip included binaries
- (cd $PACKAGE/bin; strip minizinc fzn-gecode fzn-chuffed fzn-cp-sat mzn2doc)
### Compress package
- tar -czf $PACKAGE.tar.gz $PACKAGE
artifacts:
name: "minizinc_linux_nogui_${CI_PIPELINE_ID}"
paths: [MiniZinc*.tar.gz]
needs: []
tags: [linux, docker]
.snap_job: &snap_job
stage: package
image: ghcr.io/minizinc/docker-build-environment:snap
variables:
GIT_SUBMODULE_STRATEGY: recursive
MZNARCH: "linux"
DOWNLOAD_GLOBALIZER: 1
DOWNLOAD_FINDMUS: 1
DOWNLOAD_ANALYSE: 1
<<: *packaging_setup
script:
- strip minizinc/bin/minizinc vendor/gecode_gist/bin/fzn-gecode vendor/chuffed/bin/fzn-chuffed vendor/or-tools/bin/fzn-cp-sat findMUS/bin/findMUS mzn-analyse/bin/mzn-analyse globalizer/bin/minizinc-globalizer minizinc/bin/mzn2doc
- cp resources/pkg_config/snapcraft.yaml .
- apt-get update -y
- snapcraft --destructive-mode
artifacts:
name: "minizinc_snap_${CI_PIPELINE_ID}"
paths: [minizinc*.snap]
needs: ["build:linux"]
tags: [linux, docker]
package:snap:
<<: *snap_job
only: [tags, master, develop]
package:snap_manual:
<<: *snap_job
except: [tags, master, develop]
when: manual
.snap_publish: &snap_publish
stage: publish
image: ghcr.io/minizinc/docker-build-environment:snap
tags: [linux, docker]
script:
- snapcraft upload minizinc*.snap --release $SNAPCRAFT_CHANNEL
needs: ["package:snap"]
publish:snap_edge:
variables:
SNAPCRAFT_CHANNEL: edge
<<: *snap_publish
only: [develop]
publish:snap_stable:
variables:
SNAPCRAFT_CHANNEL: stable
<<: *snap_publish
only: [tags]
when: manual # Don't publish to stable channel automatically
publish:github_edge:
stage: publish
image: ghcr.io/minizinc/docker-build-environment:package
variables:
REMOTE_URL: https://minizinc-ci:${ACCESS_TOKEN}@gitlab.com/minizinc/minizinc-ide.git
script:
# Update edge tag
- git config user.name "$GITLAB_USER_NAME"
- git config user.email "$GITLAB_USER_EMAIL"
- git remote add gitlab_remote "${REMOTE_URL}" || git remote set-url gitlab_remote "${REMOTE_URL}"
- git tag -f -a -m "Development build of MiniZinc" edge
- git push -f gitlab_remote edge -o ci.skip
# Remove old assets
- gh release --repo MiniZinc/MiniZincIDE view edge --json assets --jq '.assets[].name' | xargs -n 1 -r gh release --repo MiniZinc/MiniZincIDE delete-asset -y edge
# Upload new assets
- gh release --repo MiniZinc/MiniZincIDE upload edge MiniZincIDE*.dmg MiniZincIDE*.exe MiniZincIDE*.AppImage MiniZincIDE*.tgz MiniZincIDE*.sha256
needs: ["package:osx", "package:win64", "package:appimage", "package:linux"]
only: [develop]
tags: [linux, docker]
publish:github_stable:
stage: publish
image: ghcr.io/minizinc/docker-build-environment:package
script:
- NOTES="This release"
- '[ "$(echo "$CI_COMMIT_TAG" | cut -d. -f3)" == "0" ] && NOTES="$NOTES adds several new features and"'
- NOTES="$NOTES fixes a number of bugs, see https://docs.minizinc.dev/en/${CI_COMMIT_TAG}/changelog.html for a full change log. Binary releases for different platforms are available in the bundled packages of the MiniZinc IDE at https://github.com/minizinc/minizincide/releases."
- gh release --repo MiniZinc/libminizinc create --draft --title "MiniZinc $CI_COMMIT_TAG" --notes "$NOTES" "$CI_COMMIT_TAG"
- echo "Please refer to the change log for details:" > ide_notes
- echo "https://docs.minizinc.dev/en/${CI_COMMIT_TAG}/changelog.html" >> ide_notes
- gh release --repo MiniZinc/MiniZincIDE create --draft --title "MiniZinc $CI_COMMIT_TAG" --notes-file ide_notes "$CI_COMMIT_TAG" MiniZincIDE*.dmg MiniZincIDE*.exe MiniZincIDE*.AppImage MiniZincIDE*.tgz MiniZincIDE*.sha256
needs: ["package:osx", "package:win64", "package:appimage", "package:linux"]
only: [tags]
except: [edge]
tags: [linux, docker]