| 1 |
stages: |
| 2 |
- build |
| 3 |
- test |
| 4 |
- trigger |
| 5 |
- bench |
| 6 |
|
| 7 |
.download_bundle: &download_bundle |
| 8 |
- sh ${VENDOR_SCRIPT} minizinc-vendor master bundle:${MZNARCH} vendor.zip |
| 9 |
- unzip -q vendor.zip |
| 10 |
|
| 11 |
.download_bundle_win: &download_bundle_win |
| 12 |
- sh %VENDOR_SCRIPT% minizinc-vendor master bundle:%MZNARCH% vendor.zip |
| 13 |
- unzip -q vendor.zip |
| 14 |
|
| 15 |
variables: |
| 16 |
|
| 17 |
CCACHE_DIR: "$CI_PROJECT_DIR/.ccache" |
| 18 |
CCACHE_MAXSIZE: "100M" |
| 19 |
|
| 20 |
MACOSX_DEPLOYMENT_TARGET: "10.9" |
| 21 |
CMAKE_OSX_ARCHITECTURES: "x86_64;arm64" |
| 22 |
|
| 23 |
default: |
| 24 |
interruptible: true |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
.build: |
| 29 |
stage: build |
| 30 |
before_script: |
| 31 |
- bash download_vendor |
| 32 |
script: |
| 33 |
- cmake -S . -B build -G"$CMAKE_ARCH" -DCMAKE_BUILD_TYPE=Release -DBUILD_REF=$CI_PIPELINE_ID -DGecode_ROOT="$CI_PROJECT_DIR/vendor/gecode" -DOsiCBC_ROOT="$CI_PROJECT_DIR/vendor/cbc" -DCMAKE_INSTALL_PREFIX="$CI_PROJECT_DIR/minizinc" |
| 34 |
- cmake --build build --config Release --target install |
| 35 |
artifacts: |
| 36 |
paths: [minizinc/] |
| 37 |
cache: |
| 38 |
key: "$CI_JOB_STAGE:$CI_JOB_NAME" |
| 39 |
paths: [.ccache, vendor/] |
| 40 |
variables: |
| 41 |
CMAKE_C_COMPILER_LAUNCHER: "ccache" |
| 42 |
CMAKE_CXX_COMPILER_LAUNCHER: "ccache" |
| 43 |
only: [tags, merge_requests, pipelines, develop, master] |
| 44 |
|
| 45 |
build:linux: |
| 46 |
extends: .build |
| 47 |
image: ghcr.io/minizinc/docker-build-environment:cpp |
| 48 |
variables: |
| 49 |
MZNARCH: "linux" |
| 50 |
CMAKE_ARCH: "Ninja" |
| 51 |
tags: [linux, docker] |
| 52 |
|
| 53 |
build:linux-arm64: |
| 54 |
extends: .build |
| 55 |
image: ghcr.io/minizinc/docker-build-environment:cpp |
| 56 |
variables: |
| 57 |
MZNARCH: "linux-arm64" |
| 58 |
CMAKE_ARCH: "Ninja" |
| 59 |
tags: [linux-arm64] |
| 60 |
|
| 61 |
build:musl: |
| 62 |
extends: .build |
| 63 |
image: ghcr.io/minizinc/docker-build-environment:alpine |
| 64 |
variables: |
| 65 |
MZNARCH: "musl" |
| 66 |
CMAKE_ARCH: "Ninja" |
| 67 |
tags: [linux, docker] |
| 68 |
|
| 69 |
build:musl-arm64: |
| 70 |
extends: .build |
| 71 |
image: ghcr.io/minizinc/docker-build-environment:alpine |
| 72 |
variables: |
| 73 |
MZNARCH: "musl-arm64" |
| 74 |
CMAKE_ARCH: "Ninja" |
| 75 |
tags: [linux-arm64] |
| 76 |
|
| 77 |
build:osx: |
| 78 |
extends: .build |
| 79 |
variables: |
| 80 |
MZNARCH: "osx" |
| 81 |
CMAKE_ARCH: "Ninja" |
| 82 |
tags: [osx, cmake, cpp] |
| 83 |
|
| 84 |
build:win64: |
| 85 |
extends: .build |
| 86 |
variables: |
| 87 |
MZNARCH: "win64" |
| 88 |
CMAKE_ARCH: "Ninja" |
| 89 |
CMAKE_C_COMPILER_LAUNCHER: "buildcache" |
| 90 |
CMAKE_CXX_COMPILER_LAUNCHER: "buildcache" |
| 91 |
BUILDCACHE_DIR: "$CI_PROJECT_DIR/.ccache" |
| 92 |
BUILDCACHE_MAX_CACHE_SIZE: "104857600" |
| 93 |
script: |
| 94 |
- cmake -S . -B build -G"%CMAKE_ARCH%" -DCMAKE_BUILD_TYPE=Release -DBUILD_REF=%CI_PIPELINE_ID% -DGecode_ROOT="%CI_PROJECT_DIR%/vendor/gecode" -DOsiCBC_ROOT="%CI_PROJECT_DIR%/vendor/cbc" -DCMAKE_INSTALL_PREFIX="%CI_PROJECT_DIR%/minizinc" |
| 95 |
- cmake --build build --config Release --target install |
| 96 |
cache: |
| 97 |
key: "build_win64" |
| 98 |
tags: [win64, cmake, cpp, ninja, buildcache] |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
test:format: |
| 103 |
stage: test |
| 104 |
image: ghcr.io/minizinc/docker-build-environment:clang-tools |
| 105 |
script: |
| 106 |
- cmake -S . -B build -GNinja -DCLANG_FORMAT_EXECUTABLE="run-clang-format" -DCLANG_FORMAT_FLAGS="--color always" |
| 107 |
- cmake --build build --target format |
| 108 |
tags: [linux, docker] |
| 109 |
only: |
| 110 |
changes: |
| 111 |
- "**/*.{cpp,c,h,hh,hpp}" |
| 112 |
- .clang-format |
| 113 |
refs: |
| 114 |
- merge_requests |
| 115 |
needs: [] |
| 116 |
|
| 117 |
test:analyse: |
| 118 |
extends: .build |
| 119 |
stage: test |
| 120 |
image: ghcr.io/minizinc/docker-build-environment:clang-tools |
| 121 |
variables: |
| 122 |
MZNARCH: "musl" |
| 123 |
CMAKE_ARCH: "Ninja" |
| 124 |
script: |
| 125 |
- cmake -S . -B build -G"$CMAKE_ARCH" -DCMAKE_CXX_CLANG_TIDY="clang-tidy" -DCMAKE_BUILD_TYPE="Debug" -DGecode_ROOT="$CI_PROJECT_DIR/vendor/gecode" -DOsiCBC_ROOT="$CI_PROJECT_DIR/vendor/cbc" |
| 126 |
- cmake --build build --config Debug |
| 127 |
tags: [linux, docker] |
| 128 |
only: |
| 129 |
changes: |
| 130 |
- "**/*.{cpp,c,h,hh,hpp}" |
| 131 |
- .clang-tidy |
| 132 |
refs: |
| 133 |
- merge_requests |
| 134 |
needs: [] |
| 135 |
|
| 136 |
.tests: |
| 137 |
stage: test |
| 138 |
variables: |
| 139 |
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" |
| 140 |
MZN_SOLVER_PATH: "$CI_PROJECT_DIR/vendor/chuffed/share/minizinc/solvers/:$CI_PROJECT_DIR/vendor/gecode/share/minizinc/solvers/" |
| 141 |
MZN_TEST_TAGS_PRESENT: gecode_presolver,cbc,cplex,highs,scip,gurobi,xpress |
| 142 |
before_script: |
| 143 |
- *download_bundle |
| 144 |
- export PATH=$CI_PROJECT_DIR/minizinc/bin:$PATH |
| 145 |
- minizinc --solvers |
| 146 |
- cd tests |
| 147 |
- python3 -m venv env |
| 148 |
- source env/bin/activate |
| 149 |
- pip install -r requirements.txt |
| 150 |
after_script: |
| 151 |
- echo "Test results at https://minizinc.gitlab.io/-/minizinc/-/jobs/${CI_JOB_ID}/artifacts/tests/output/report.html" |
| 152 |
artifacts: |
| 153 |
when: always |
| 154 |
paths: |
| 155 |
- tests/output/ |
| 156 |
reports: |
| 157 |
junit: tests/output/junit*.xml |
| 158 |
cache: |
| 159 |
key: "$CI_JOB_STAGE:$CI_JOB_NAME" |
| 160 |
paths: [.cache/pip, vendor.zip*] |
| 161 |
only: [merge_requests, pipelines, master] |
| 162 |
|
| 163 |
|
| 164 |
.tests_linux: |
| 165 |
extends: .tests |
| 166 |
image: python:3.11 |
| 167 |
variables: |
| 168 |
MZNARCH: "linux" |
| 169 |
LD_LIBRARY_PATH: "$CI_PROJECT_DIR/vendor/highs/lib64" |
| 170 |
tags: [linux, docker] |
| 171 |
dependencies: ["build:linux"] |
| 172 |
needs: ["build:linux"] |
| 173 |
|
| 174 |
|
| 175 |
.tests_osx: |
| 176 |
extends: .tests |
| 177 |
variables: |
| 178 |
MZNARCH: "osx" |
| 179 |
DYLD_LIBRARY_PATH: "$CI_PROJECT_DIR/vendor/highs/lib" |
| 180 |
tags: [osx] |
| 181 |
dependencies: ["build:osx"] |
| 182 |
needs: ["build:osx"] |
| 183 |
|
| 184 |
|
| 185 |
.tests_win64: |
| 186 |
extends: .tests |
| 187 |
variables: |
| 188 |
MZNARCH: "win64" |
| 189 |
MZN_SOLVER_PATH: "$CI_PROJECT_DIR/vendor/chuffed/share/minizinc/solvers/;$CI_PROJECT_DIR/vendor/gecode/share/minizinc/solvers/" |
| 190 |
before_script: |
| 191 |
- *download_bundle_win |
| 192 |
- set PATH=%CI_PROJECT_DIR%/minizinc/bin;%CI_PROJECT_DIR%/vendor/highs/bin;%PATH% |
| 193 |
- cd tests |
| 194 |
- python -m venv env |
| 195 |
- call env\Scripts\activate.bat |
| 196 |
- pip install -r requirements.txt |
| 197 |
after_script: |
| 198 |
- "echo Test results at https://minizinc.gitlab.io/-/minizinc/-/jobs/%CI_JOB_ID%/artifacts/tests/output/report.html" |
| 199 |
tags: [win64] |
| 200 |
dependencies: ["build:win64"] |
| 201 |
needs: ["build:win64"] |
| 202 |
cache: |
| 203 |
key: test_win64 |
| 204 |
|
| 205 |
.tests_fast: |
| 206 |
script: |
| 207 |
- pytest |
| 208 |
|
| 209 |
.tests_full: |
| 210 |
script: |
| 211 |
- pytest --all-suites |
| 212 |
when: manual |
| 213 |
|
| 214 |
test:linux:fast: |
| 215 |
extends: [.tests_linux, .tests_fast] |
| 216 |
artifacts: |
| 217 |
expose_as: test-linux |
| 218 |
|
| 219 |
test:linux:full: |
| 220 |
extends: [.tests_linux, .tests_full] |
| 221 |
|
| 222 |
test:osx:fast: |
| 223 |
extends: [.tests_osx, .tests_fast] |
| 224 |
artifacts: |
| 225 |
expose_as: test-osx |
| 226 |
|
| 227 |
test:osx:full: |
| 228 |
extends: [.tests_osx, .tests_full] |
| 229 |
|
| 230 |
test:win64:fast: |
| 231 |
extends: [.tests_win64, .tests_fast] |
| 232 |
cache: |
| 233 |
key: test_win64_fast |
| 234 |
artifacts: |
| 235 |
expose_as: test-win64 |
| 236 |
|
| 237 |
test:win64:full: |
| 238 |
extends: [.tests_win64, .tests_full] |
| 239 |
cache: |
| 240 |
key: test_win64_full |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
.flatten_benchmark: |
| 245 |
stage: bench |
| 246 |
variables: |
| 247 |
MZNARCH: linux |
| 248 |
|
| 249 |
FLATTEN_PREFIX: srun -w critical001 --nice --mem=8192 -t 10 |
| 250 |
PARALLEL_JOBS: "-1" |
| 251 |
tags: [slurm] |
| 252 |
dependencies: ["build:linux"] |
| 253 |
needs: ["build:linux"] |
| 254 |
before_script: |
| 255 |
- cd tests/flattening |
| 256 |
- mkdir -p results |
| 257 |
|
| 258 |
- curl --retry 10 --location --silent https://gitlab.com/-/snippets/2095682/raw/master/instances.csv | tr -d '\r' > instances.csv |
| 259 |
- git clone https://github.com/minizinc/minizinc-benchmarks.git |
| 260 |
script: |
| 261 |
|
| 262 |
- python3 flatten.py --minizinc="$CI_PROJECT_DIR/minizinc/bin/minizinc" --prefix-args="$FLATTEN_PREFIX" --args="-G $MZNLIB" --parallel="$PARALLEL_JOBS" instances.csv results/stats.csv |
| 263 |
artifacts: |
| 264 |
paths: |
| 265 |
- tests/flattening/results/ |
| 266 |
expose_as: $CI_JOB_NAME |
| 267 |
cache: |
| 268 |
key: "$CI_JOB_STAGE:$CI_JOB_NAME" |
| 269 |
paths: [.cache/pip] |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
bench:std:manual: |
| 290 |
extends: .flatten_benchmark |
| 291 |
variables: |
| 292 |
MZNLIB: std |
| 293 |
artifacts: |
| 294 |
expose_as: bench-std-manual |
| 295 |
|
| 296 |
only: [merge_requests, pipelines, tags, master, develop] |
| 297 |
when: manual |
| 298 |
|
| 299 |
bench:linear:manual: |
| 300 |
extends: .flatten_benchmark |
| 301 |
variables: |
| 302 |
MZNLIB: linear |
| 303 |
artifacts: |
| 304 |
expose_as: bench-linear-manual |
| 305 |
|
| 306 |
only: [merge_requests, pipelines, tags, master, develop] |
| 307 |
when: manual |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
documentation: |
| 312 |
stage: test |
| 313 |
image: ghcr.io/minizinc/docker-build-environment:sphinx |
| 314 |
variables: |
| 315 |
MZNARCH: "linux" |
| 316 |
before_script: |
| 317 |
- *download_bundle |
| 318 |
script: |
| 319 |
- cp $CI_PROJECT_DIR/vendor/gecode/share/minizinc/gecode/gecode.mzn $CI_PROJECT_DIR/share/minizinc/std/ |
| 320 |
- cp $CI_PROJECT_DIR/vendor/chuffed/share/minizinc/chuffed/chuffed.mzn $CI_PROJECT_DIR/share/minizinc/std/ |
| 321 |
- echo 'include "globals.mzn"; include "gecode.mzn"; include "chuffed.mzn"; include "ide/vis.mzn"; include "experimental/all.mzn";' > $CI_PROJECT_DIR/share/minizinc/std/all.mzn |
| 322 |
- ./minizinc/bin/mzn2doc --rst-output --include-stdlib --output-base $CI_PROJECT_DIR/docs/en/lib $CI_PROJECT_DIR/share/minizinc/std/all.mzn |
| 323 |
- ./minizinc/bin/mzn2doc --rst-output --include-stdlib --output-base $CI_PROJECT_DIR/docs/chi/lib $CI_PROJECT_DIR/share/minizinc/std/all.mzn |
| 324 |
- cd $CI_PROJECT_DIR/docs |
| 325 |
- make BUILDDIR="en/_build" html latexpdf |
| 326 |
- make SPHINXOPTS="-D language=zh_CN" BUILDDIR="chi/_build" html latexpdf |
| 327 |
- MZNVERSION=$(python3 "$CI_PROJECT_DIR/docs/utils/minizinc_version.py") |
| 328 |
- mkdir -p $CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}/en |
| 329 |
- mkdir -p $CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}/chi |
| 330 |
- cp -r $CI_PROJECT_DIR/docs/en/_build/html/* $CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}/en/ |
| 331 |
- cp $CI_PROJECT_DIR/docs/en/_build/latex/MiniZinc.pdf $CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}/en/MiniZinc\ Handbook.pdf |
| 332 |
- cp -r $CI_PROJECT_DIR/docs/chi/_build/html/* $CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}/chi/ |
| 333 |
- cp $CI_PROJECT_DIR/docs/chi/_build/latex/MiniZinc.pdf $CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}/chi/MiniZinc\ Handbook.pdf |
| 334 |
- python3 "$CI_PROJECT_DIR/docs/utils/gen_redirects.py" "$CI_PROJECT_DIR/docs-deploy/doc-${MZNVERSION}" "$CI_PROJECT_DIR/docs-deploy/doc-latest" |
| 335 |
artifacts: |
| 336 |
paths: |
| 337 |
- docs-deploy/ |
| 338 |
expose_as: documentation |
| 339 |
tags: |
| 340 |
- linux |
| 341 |
- docker |
| 342 |
only: [tags, merge_requests, pipelines, develop, master] |
| 343 |
dependencies: ["build:linux"] |
| 344 |
needs: ["build:linux"] |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
trigger:findmus: |
| 349 |
stage: trigger |
| 350 |
trigger: |
| 351 |
project: minizinc/FindMUS |
| 352 |
branch: develop |
| 353 |
only: [develop] |