image: ralfjung/opam-ci:opam2

stages:
  - build

variables:
  CPU_CORES: "10"
  OCAML: "ocaml-variants.4.14.0+options ocaml-option-flambda"

.only_branches: &only_branches
  only:
  - /^master/@iris/iris
  - /^ci/@iris/iris

.only_mr: &only_mr
  only:
  - merge_requests

.branches_and_mr: &branches_and_mr
  only:
  - /^master/@iris/iris
  - /^ci/@iris/iris
  - merge_requests

.template: &template
  <<: *only_branches
  stage: build
  interruptible: true
  tags:
  - fp
  script:
  - git clone https://gitlab.mpi-sws.org/iris/ci.git ci -b opam2
  - ci/buildjob
  cache:
    key: "$CI_JOB_NAME"
    paths:
    - _opam/
  except:
  - triggers
  - schedules
  - api

## Build jobs

build-coq.8.16.dev:
  <<: *template
  variables:
    OPAM_PINS: "coq version 8.16.dev"

build-coq.8.15.1:
  <<: *template
  variables:
    OPAM_PINS: "coq version 8.15.1"
    DENY_WARNINGS: "1"
    MANGLE_NAMES: "1"
    OPAM_PKG: "1"
    DOC_DIR: "coqdoc@center.mpi-sws.org:iris"
    DOC_OPTS: "--external https://plv.mpi-sws.org/coqdoc/stdpp/ stdpp"
  tags:
  - fp-timing
  interruptible: false

build-coq.8.14.1:
  <<: *template
  <<: *branches_and_mr
  variables:
    OPAM_PINS: "coq version 8.14.1"
    MANGLE_NAMES: "1"
    DENY_WARNINGS: "1"
    OCAML: "ocaml-base-compiler.4.07.1"

build-coq.8.13.2:
  <<: *template
  <<: *branches_and_mr
  variables:
    OPAM_PINS: "coq version 8.13.2"
    DENY_WARNINGS: "1"
    OCAML: "ocaml-base-compiler.4.07.1"

# Nightly job with a known-to-work Coq version
# (so failures must be caused by std++)
trigger-stdpp.dev-coq.8.15.1:
  <<: *template
  variables:
    STDPP_REPO: "iris/stdpp"
    OPAM_PINS: "coq version 8.15.1   git+https://gitlab.mpi-sws.org/$STDPP_REPO#$STDPP_REV"
  except:
  only:
  - triggers
  - schedules
  - api

# Nightly job with latest Coq branch
trigger-stdpp.dev-coq.dev:
  <<: *template
  variables:
    STDPP_REPO: "iris/stdpp"
    OPAM_PINS: "coq version dev   git+https://gitlab.mpi-sws.org/$STDPP_REPO#$STDPP_REV"
    CI_COQCHK: "1"
  except:
  only:
  - triggers
  - schedules
  - api