forked from MiniZinc/libminizinc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
296 lines (263 loc) · 12 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
stages:
- build
- test
- trigger
.download_vendor: &download_vendor
- curl --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" --silent https://gitlab.com/api/v4/snippets/1796163/raw | tr -d '\r' > download.sh
- sh download.sh vendor master vendor:${MZNARCH} vendor.zip
- unzip -q vendor.zip
.download_vendor: &download_vendor_win
- curl -o download.sh --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" --silent https://gitlab.com/api/v4/snippets/1796163/raw
- dos2unix download.sh
- sh download.sh vendor master vendor:%MZNARCH% vendor.zip
- unzip -q vendor.zip
.download_bundle: &download_bundle
- curl --location --header "PRIVATE-TOKEN:$ACCESS_TOKEN" --silent https://gitlab.com/api/v4/snippets/1796163/raw | tr -d '\r' > download.sh
- sh download.sh vendor master bundle:${MZNARCH} vendor.zip
- unzip -q vendor.zip
.download_bundle: &download_bundle_win
- curl -o download.sh --location --header "PRIVATE-TOKEN:%ACCESS_TOKEN%" --silent https://gitlab.com/api/v4/snippets/1796163/raw
- dos2unix download.sh
- sh download.sh vendor master bundle:%MZNARCH% vendor.zip
- unzip -q vendor.zip
variables:
# CCache settings
CCACHE_DIR: "$CI_PROJECT_DIR/.ccache"
CCACHE_MAXSIZE: "100M"
default:
interruptible: true
# ----------- Build MiniZinc -----------
.build:
stage: build
before_script:
- *download_vendor
script:
- cmake -S . -B build -G"$CMAKE_ARCH" -DCMAKE_BUILD_TYPE=Release -DBUILD_REF=$CI_PIPELINE_ID -DUSE_PROPRIETARY=OFF -DGecode_ROOT="$CI_PROJECT_DIR/vendor/gecode" -DGurobi_ROOT="$CI_PROJECT_DIR/vendor/gurobi" -DCPlex_ROOT="$CI_PROJECT_DIR/vendor/CPLEX_Studio/cplex" -DOsiCBC_ROOT="$CI_PROJECT_DIR/vendor/cbc" -DSCIP_ROOT="$CI_PROJECT_DIR/vendor/scip" -DXpress_ROOT="$CI_PROJECT_DIR/vendor/xpressmp" -DCMAKE_INSTALL_PREFIX="$CI_PROJECT_DIR/minizinc"
- cmake --build build --config Release --target install
artifacts:
paths: [minizinc/]
cache:
key: "$CI_JOB_STAGE:$CI_JOB_NAME"
paths: [.ccache, vendor.zip*]
only: [tags, merge_requests, pipelines, develop, master]
build:linux:
extends: .build
image: dekker1/minibuild:cpp
variables:
MZNARCH: "linux"
CMAKE_ARCH: "Ninja"
tags: [linux, docker]
build:musl:
extends: .build
image: dekker1/minibuild:alpine
variables:
MZNARCH: "musl"
CMAKE_ARCH: "Ninja"
tags: [linux, docker]
build:osx:
extends: .build
variables:
MZNARCH: "osx"
CMAKE_ARCH: "Ninja"
tags: [osx, cmake, cpp]
build:win64:
extends: .build
variables:
MZNARCH: "win64"
CMAKE_ARCH: "Visual Studio 15 2017 Win64"
before_script:
- *download_vendor_win
script:
- cmake -S . -B build -G"%CMAKE_ARCH%" -DBUILD_REF=%CI_PIPELINE_ID% -DUSE_PROPRIETARY=OFF -DGecode_ROOT="%CI_PROJECT_DIR%/vendor/gecode" -DGurobi_ROOT="%CI_PROJECT_DIR%/vendor/gurobi" -DCPlex_ROOT="%CI_PROJECT_DIR%/vendor/CPLEX_Studio/cplex" -DOsiCBC_ROOT="%CI_PROJECT_DIR%/vendor/cbc" -DSCIP_ROOT="%CI_PROJECT_DIR%/vendor/scip" -DXpress_ROOT="%CI_PROJECT_DIR%/vendor/xpressmp" -DCMAKE_INSTALL_PREFIX="%CI_PROJECT_DIR%/minizinc"
- cmake --build build --config Release --target install
cache:
key: "build_win64"
paths: [vendor.zip*]
tags: [win64, cmake, cpp]
only: [tags, merge_requests, pipelines, develop, master]
build:wasm_complete:
extends: .build
image: emscripten/emsdk
variables:
MZNARCH: "wasm"
CMAKE_ARCH: "Unix Makefiles"
script:
- apt-get update && apt-get install -qq python3
- emcmake cmake -S . -B build -G"$CMAKE_ARCH" -DCMAKE_FIND_ROOT_PATH="/" -DCMAKE_BUILD_TYPE=MinSizeRel -v -DBUILD_REF=$CI_PIPELINE_ID -DUSE_PROPRIETARY=OFF -DGecode_ROOT="$CI_PROJECT_DIR/vendor/gecode" -DGurobi_ROOT="$CI_PROJECT_DIR/vendor/gurobi" -DCPlex_ROOT="$CI_PROJECT_DIR/vendor/CPLEX_Studio/cplex" -DOsiCBC_ROOT="$CI_PROJECT_DIR/vendor/cbc" -DSCIP_ROOT="$CI_PROJECT_DIR/vendor/scip" -DXpress_ROOT="$CI_PROJECT_DIR/vendor/xpressmp" -DCMAKE_INSTALL_PREFIX="$CI_PROJECT_DIR/minizinc"
- cmake --build build --config MinSizeRel --target install
tags: [docker, high-mem]
when: manual
build:wasm_minimal:
extends: .build
image: emscripten/emsdk
variables:
MZNARCH: "wasm"
CMAKE_ARCH: "Unix Makefiles"
script:
- apt-get update && apt-get install -qq python3
- emcmake cmake -S . -B build -G"$CMAKE_ARCH" -DCMAKE_BUILD_TYPE=MinSizeRel -v -DBUILD_REF=$CI_PIPELINE_ID -DUSE_PROPRIETARY=OFF -DGecode_ROOT="$CI_PROJECT_DIR/vendor/gecode" -DGurobi_ROOT="$CI_PROJECT_DIR/vendor/gurobi" -DCPlex_ROOT="$CI_PROJECT_DIR/vendor/CPLEX_Studio/cplex" -DOsiCBC_ROOT="$CI_PROJECT_DIR/vendor/cbc" -DSCIP_ROOT="$CI_PROJECT_DIR/vendor/scip" -DXpress_ROOT="$CI_PROJECT_DIR/vendor/xpressmp" -DCMAKE_INSTALL_PREFIX="$CI_PROJECT_DIR/minizinc"
- cmake --build build --config MinSizeRel --target install
tags: [docker]
when: manual
# ----------- Test Suite -----------
test:format:
stage: test
image: dekker1/minibuild:clang-format
script:
- cmake -S . -B build -GNinja -DCLANG_FORMAT_EXECUTABLE="run-clang-format" -DCLANG_FORMAT_FLAGS="--color always"
- cmake --build build --target format
tags: [linux, docker]
only:
changes:
- "**/*.{cpp,c,h,hh,hpp}"
- .clang-format
refs:
- merge_requests
needs: []
test:analyse:
extends: .build
stage: test
image: dekker1/minibuild:clang-tidy
variables:
MZNARCH: "linux"
CMAKE_ARCH: "Ninja"
script:
- cmake -S . -B build -G"$CMAKE_ARCH" -DCMAKE_CXX_CLANG_TIDY="clang-tidy" -DCMAKE_BUILD_TYPE="Debug" -DGecode_ROOT="$CI_PROJECT_DIR/vendor/gecode" -DGurobi_ROOT="$CI_PROJECT_DIR/vendor/gurobi" -DCPlex_ROOT="$CI_PROJECT_DIR/vendor/CPLEX_Studio/cplex" -DOsiCBC_ROOT="$CI_PROJECT_DIR/vendor/cbc" -DSCIP_ROOT="$CI_PROJECT_DIR/vendor/scip" -DXpress_ROOT="$CI_PROJECT_DIR/vendor/xpressmp"
- cmake --build build --config Debug
tags: [linux, docker]
only:
changes:
- "**/*.{cpp,c,h,hh,hpp}"
- .clang-tidy
refs:
- merge_requests
needs: []
.tests:
stage: test
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
MZN_SOLVER_PATH: "$CI_PROJECT_DIR/vendor/chuffed/share/minizinc/solvers/:$CI_PROJECT_DIR/vendor/gecode"
before_script:
- *download_bundle
# TODO: Add gecode configuration to the Gecode solver
- "echo '{\"id\":\"org.gecode.gecode\",\"name\":\"Gecode\",\"description\":\"Gecode FlatZinc executable\",\"version\":\"6.1.1\",\"mznlib\":\"share/gecode/mznlib\",\"executable\":\"bin/fzn-gecode\",\"tags\":[\"cp\",\"int\",\"float\",\"set\",\"restart\"],\"stdFlags\":[\"-a\",\"-f\",\"-n\",\"-p\",\"-r\",\"-s\",\"-t\"],\"extraFlags\":[[\"-c-d\",\"Recomputation commit distance\",\"int\",\"8\"],[\"-a-d\",\"Recomputation adaption distance\",\"int\",\"2\"],[\"-decay\",\"Decay factor\",\"float\",\"0.99\"],[\"-node\",\"Node cutoff\",\"int\",\"0\"],[\"-fail\",\"Failure cutoff\",\"int\",\"0\"],[\"-restart\",\"Restart sequence type\",\"opt:none:constant:linear:luby:geometric\",\"none\"],[\"-restart-base\",\"Base for geometric restart sequence\",\"float\",\"1.5\"],[\"-restart-scale\",\"Scale factor for restart sequence\",\"int\",\"250\"],[\"-nogoods\",\"Use no-goods from restarts\",\"bool\",\"false\"],[\"-nogoods-limit\",\"Depth limit for no-good extraction\",\"int\",\"128\"]],\"supportsMzn\":false,\"supportsFzn\":true,\"needsSolns2Out\":true,\"needsMznExecutable\":false,\"needsStdlibDir\":false,\"isGUIApplication\":false}' > vendor/gecode/gecode.msc"
- export PATH=$CI_PROJECT_DIR/minizinc/bin:$PATH
- minizinc --solvers
- cd tests
- python3 -m venv env
- source env/bin/activate
- pip install -r requirements.txt
after_script:
- echo "Test results at https://minizinc.gitlab.io/-/minizinc/-/jobs/${CI_JOB_ID}/artifacts/tests/output/report.html"
artifacts:
when: always
paths:
- tests/output
reports:
junit: tests/output/junit*.xml
cache:
key: "$CI_JOB_STAGE:$CI_JOB_NAME"
paths: [.cache/pip, vendor.zip*]
only: [merge_requests, pipelines, master]
# Linux specific config
.tests_linux:
extends: .tests
image: python:latest
variables:
MZNARCH: "linux"
tags: [linux, docker]
dependencies: ["build:linux"]
needs: ["build:linux"]
# OSX specific config
.tests_osx:
extends: .tests
variables:
MZNARCH: "osx"
tags: [osx]
dependencies: ["build:osx"]
needs: ["build:osx"]
# Windows specific config
.tests_win64:
extends: .tests
variables:
MZNARCH: "win64"
MZN_SOLVER_PATH: "$CI_PROJECT_DIR/vendor/chuffed/share/minizinc/solvers;$CI_PROJECT_DIR/vendor/gecode"
before_script:
- *download_bundle_win
# TODO: Add gecode configuration to the Gecode solver
- 'echo {"id":"org.gecode.gecode","name":"Gecode","description":"Gecode FlatZinc executable","version":"6.1.1","mznlib":"share/gecode/mznlib","executable":"bin/fzn-gecode","tags":["cp","int","float","set","restart"],"stdFlags":["-a","-f","-n","-p","-r","-s","-t"],"extraFlags":[["-c-d","Recomputation commit distance","int","8"],["-a-d","Recomputation adaption distance","int","2"],["-decay","Decay factor","float","0.99"],["-node","Node cutoff","int","0"],["-fail","Failure cutoff","int","0"],["-restart","Restart sequence type","opt:none:constant:linear:luby:geometric","none"],["-restart-base","Base for geometric restart sequence","float","1.5"],["-restart-scale","Scale factor for restart sequence","int","250"],["-nogoods","Use no-goods from restarts","bool","false"],["-nogoods-limit","Depth limit for no-good extraction","int","128"]],"supportsMzn":false,"supportsFzn":true,"needsSolns2Out":true,"needsMznExecutable":false,"needsStdlibDir":false,"isGUIApplication":false} > vendor/gecode/gecode.msc'
- set PATH=%CI_PROJECT_DIR%/minizinc/bin;%PATH%
- cd tests
- python -m venv env
- call env\Scripts\activate.bat
- pip install -r requirements.txt
after_script:
- 'echo Test results at https://minizinc.gitlab.io/-/minizinc/-/jobs/%CI_JOB_ID%/artifacts/tests/output/report.html'
tags: [win64]
dependencies: ["build:win64"]
needs: ["build:win64"]
cache:
key: test_win64
.tests_fast:
script:
- pytest
.tests_full:
script:
- pytest --all-suites
when: manual
test:linux:fast:
extends: [.tests_linux, .tests_fast]
test:linux:full:
extends: [.tests_linux, .tests_full]
test:osx:fast:
extends: [.tests_osx, .tests_fast]
test:osx:full:
extends: [.tests_osx, .tests_full]
test:win64:fast:
extends: [.tests_win64, .tests_fast]
cache:
key: test_win64_fast
test:win64:full:
extends: [.tests_win64, .tests_full]
cache:
key: test_win64_full
# ----------- Documentation -----------
documentation:
stage: test
image: guidotack/sphinx-doc:latest
variables:
MZNARCH: "linux"
before_script:
- *download_bundle
script:
- cp $CI_PROJECT_DIR/share/minizinc/gecode_presolver/gecode.mzn $CI_PROJECT_DIR/share/minizinc/std/
- cp $CI_PROJECT_DIR/vendor/chuffed/share/minizinc/chuffed/chuffed.mzn $CI_PROJECT_DIR/share/minizinc/std/
- echo 'include "globals.mzn"; include "gecode.mzn"; include "chuffed.mzn";' > $CI_PROJECT_DIR/share/minizinc/std/all.mzn
- ./minizinc/bin/mzn2doc --rst-output --include-stdlib --output-base $CI_PROJECT_DIR/docs/en/lib $CI_PROJECT_DIR/share/minizinc/std/all.mzn
- ./minizinc/bin/mzn2doc --rst-output --include-stdlib --output-base $CI_PROJECT_DIR/docs/chi/lib $CI_PROJECT_DIR/share/minizinc/std/all.mzn
- cd $CI_PROJECT_DIR/docs/en
- make html latexpdf
- cd $CI_PROJECT_DIR/docs/chi
- make html latexpdf
- mkdir -p $CI_PROJECT_DIR/docs-deploy/en
- mkdir -p $CI_PROJECT_DIR/docs-deploy/chi
- cp -r $CI_PROJECT_DIR/docs/en/_build/html/* $CI_PROJECT_DIR/docs-deploy/en/
- cp $CI_PROJECT_DIR/docs/en/_build/latex/MiniZinc.pdf $CI_PROJECT_DIR/docs-deploy/en/MiniZinc\ Handbook.pdf
- cp -r $CI_PROJECT_DIR/docs/chi/_build/html/* $CI_PROJECT_DIR/docs-deploy/chi/
- cp $CI_PROJECT_DIR/docs/chi/_build/latex/MiniZinc.pdf $CI_PROJECT_DIR/docs-deploy/chi/MiniZinc\ Handbook.pdf
artifacts:
paths:
- docs-deploy
tags:
- linux
- docker
only: [tags, merge_requests, pipelines, develop, master]
dependencies: ["build:linux"]
needs: ["build:linux"]
# ----------- Trigger FindMUS pipeline -----------
trigger:findmus:
stage: trigger
trigger:
project: minizinc/FindMUS
branch: develop
only: [develop]