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, feature/on_restart] 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: "Ninja" BUILDCACHE_DIR: "$CI_PROJECT_DIR/.ccache" BUILDCACHE_MAX_CACHE_SIZE: "104857600" before_script: - *download_vendor_win script: - cmake -S . -B build -G"%CMAKE_ARCH%" -DCMAKE_BUILD_TYPE=Release -DBUILD_REF=%CI_PIPELINE_ID% -DCCACHE_PROGRAM:STRING=buildcache -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" tags: [win64, cmake, cpp, ninja, buildcache] 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]