image: ocaml/opam:ubuntu-18.04

stages:
  - build
  - release
  - deploy
  
build:
  stage: build
  script:
    - opam repo add verimag-sync-repo "http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/opam-repository"
    - eval `opam config env`
    - sudo apt-get update
    - opam depext -y lustre-v6 lutin lablgtk3
    - opam install -y dune ocamlgraph lutin lablgtk3
    - make
    - make install
    - make test
    - cd tools/simca
    - make && make cmxs && make log -j 15 && make pdf
  artifacts:
    paths:
      - tools/simca

simca-docker:
  image: jahierwan/verimag-reactive-toolbox
  stage: release
  script:
    - cd tools/simca
    - make && make cmxs && make log -j 15 && make pdf
  artifacts:
    paths:
      - tools/simca

 
test_opam_test:
  stage: release
  script:
    - opam repo add verimag-sync-repo "http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/test/opam-repository"
    - eval `opam config env`
    - sudo opam depext -y sasa 
    - opam install -y sasa
  allow_failure: true
  only:
    - master



# automating version numbering
release:
  image: node:12-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



pages:
  image: jahierwan/verimag-reactive-toolbox
  stage: deploy
  script:
    - make odoc
    - mkdir public
    - cd guides/users
    - make 
    - cp README.html ../../public/index.html
    - cp -rf _html  ../../public/
    - cp -rf ../styles/  ../../public/
    - cp -rf sasabatch.pdf  ../../public/
    - cp -rf sasabatch.png  ../../public/
    - cp -rf poster.png  ../../public/
    - cp -rf sasabatch.svg  ../../public/
  only:
    - master
  artifacts:
    paths:
      - public