stages:
  - test

tests:
  stage: test
  image: ocaml/opam@sha256:108b775e7bda2c6d3bddae61c9cdb003e40de746baf3a994e8f7b82d8301dd0a
  cache:
    key: $CI_COMMIT_REF_SLUG
    paths:
      - _opam
  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-base-compiler.4.11.1; fi
  - eval $(opam env)
  - sudo apt-get update
  - sudo apt install -y protobuf-compiler
  - opam repository add remote https://opam.ocaml.org
  - opam depext --yes ocplib-endian base fmt alt-ergo.2.4.0
  - opam install . --deps-only --with-test --yes
  - opam install alt-ergo.2.4.0 --yes
  - make
  - make test
  tags:
    - docker
