Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.12 KiB
stages:
  - test

variables:
  GIT_SUBMODULE_STRATEGY: normal

.build-matrix:
  parallel:
    # https://docs.gitlab.com/ee/ci/yaml/README.html#parallel-matrix-jobs
    matrix:
    # - OCAML_COMPILER: "4.00.1"
    # - OCAML_COMPILER: "4.01.0"
    # - OCAML_COMPILER: "4.02.1"
    # - OCAML_COMPILER: "4.02.3"
    # - OCAML_COMPILER: "4.03.0"
    # - OCAML_COMPILER: "4.04.2"
    # - OCAML_COMPILER: "4.05.0"
    # - OCAML_COMPILER: "4.06.1"
    # - OCAML_COMPILER: "4.07.1"
    # - OCAML_COMPILER: "4.08.1"
    # - OCAML_COMPILER: "4.09.1"
    # - OCAML_COMPILER: "4.10.0"
    - OCAML_COMPILER: "4.12.0"

tests:
  stage: test
  extends: .build-matrix # defines OCAML_COMPILER
  #docker manifest inspect ocaml/opam:debian-11-ocaml-4.14 | jq '.manifests| .[] | select(.platform.architecture == "amd64") | .digest' --raw-output
  #ocaml/opam:debian-11-ocaml-4.13
  image: ocaml/opam@sha256:c3acec02c2720d11cb3789700c199a898e83e4b42638fd00c26e5e5252fc4f46
  cache:
    # https://docs.gitlab.com/ee/ci/yaml/#cache
    key: $OCAML_COMPILER-debian
    # keep a distinct cache for each compiler version
    paths:
      - _opam
  rules:
    - when: always
  script:
  - if [ ! -d _opam ]; then echo "no local switch in the CI cache, we setup a new switch"; opam switch create --yes --no-install . $OCAML_COMPILER; fi
  - eval `opam-2.1 config env`
  - sudo apt-get update
  - opam-2.1 remote add uptodate https://opam.ocaml.org/
  - git config --global --add safe.directory /builds/pub/colibrics
  - opam-2.1 install . --deps-only --with-test --with-doc --yes --depext-only
  - opam-2.1 install . --deps-only --with-test --with-doc --yes
  - make
  - make test
  tags:
    - docker

# generate static binary
generate-static:
  stage: test
  extends: .build-matrix # defines OCAML_COMPILER
  # ocaml/opam:alpine-ocaml-4.13
  image: ocaml/opam@sha256:fc03bda1598542dfa3fbedc7734cc6c256fb26909506ae7ffb127f5f6ff50683
  cache:
    # https://docs.gitlab.com/ee/ci/yaml/#cache
    key: $OCAML_COMPILER-alpine
    # keep a distinct cache for each compiler version
    paths:
      - _opam
  script:
  - if [ ! -d _opam ]; then echo "no local switch in the CI cache, we setup a new switch"; opam-2.1 switch create --yes --no-install . $OCAML_COMPILER; fi
  - eval `opam-2.1 config env`
  - opam-2.1 remote add uptodate https://opam.ocaml.org/
  - sed -e "s/; FOR STATIC//" -i colibri2/bin/dune
  - git config --global --add safe.directory /builds/pub/colibrics
  - opam-2.1 install . --deps-only --with-test --with-doc --yes --depext-only