image: ocaml/opam2:ubuntu

variables:
  GIT_STRATEGY: clone

stages:
  - build
  - test
  - release
  
build:
  stage: build
  script:
    - sudo apt-get install -y m4
    - 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
    - opam install -y ocamlfind dune extlib
    - opam install rdbg 
    - make
    - make install

test_opam_test:
  stage: test
  script:
    - sudo apt-get install -y m4
    - 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
# 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

release:
  before_script:
    - yarn install --frozen-lockfile
  image: node:12
  only:
    - master
  script:
    - $(yarn bin)/semantic-delivery-gitlab --preset eslint  --token ${GITLAB_AUTH_TOKEN}
  stage: release
