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 sasa rdbgui4sasa kind2 lutin lustre-v6 || echo "not needed for recent opam version"
    - opam install --deps-only ./sasa.opam ./salut.opam ./rdbgui4sasa.opam
    - make
    - make install
    - make test
    - cd tools/simca
    - make && make cmxs && make log -j 15 && make pdf
    - cd ../../salut && make test
  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:14-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
