image: ocaml/opam

variables:
  GIT_STRATEGY: clone

stages:
  - build
  - test
  - release


lv6-man:
  image: jahierwan/verimag-sync-papers
  allow_failure: true
  script:
    - cd lv6-ref-man
    - make
  artifacts:
    paths:
      - doc

build:
  stage: build
  script:
    - opam repo add official "https://opam.ocaml.org/"
    - opam repo add verimag-sync-repo "http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/test/opam-repository"
    - opam update
    - sudo apt-get update
    - opam depext lustre-v6 || echo "not needed for recent opam version"
    - opam install --deps-only ./lustre-v6.opam
    - make
    - make install

test_opam_test:
  stage: test
  script:
    - opam repo add verimag-sync-repo "http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/test/opam-repository"
    - opam update
    - sudo apt-get update
    - opam depext lustre-v6 || echo "not needed for recent opam version"
    - opam install -y lustre-v6
    - lv6 -help
  allow_failure: true
# may fail if an ADT changes in lutils or rdbg-plugin, since this repo
# can only be updated if the whole pipeline succeeds (to be able te get
# the release number). The idea is to rerun this job manually  when it
# is the case.

.test_opam_on_mac:
  stage: test
  tags:
    - macos
    - docker
  script:
    - opam repo add verimag-sync-repo "http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/test/opam-repository"
    - opam update
    - opam install -y lustre-v6
    - lv6 -help
  allow_failure: true

# automating version numbering
release:
  image: node:20-buster-slim
  stage: release
  before_script:
    - apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
    - npm install -g semantic-release  @semantic-release/gitlab
  script:
    - semantic-release
  only:
    - master
