image: ocaml/opam:ubuntu-18.04-ocaml-4.14

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
    - sudo apt install bc time
    - opam depext sasa rdbgui4sasa kind2 lutin kind2 z3 || echo "not needed for recent opam version"
    - opam install --deps-only ./sasa.opam ./salut.opam ./rdbgui4sasa.opam
    - opam install lutin
    - make
    - make install
    - make test-ci
    - cd tools/simca
    - make && make cmxs && make log -j 15 && make pdf
  artifacts:
    paths:
      - tools/simca

simca-docker:
  image: gricad-registry.univ-grenoble-alpes.fr/verimag/synchrone/tools-distrib/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:
    - sudo apt update
    - 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 lutin rdbgui4sasa || echo "not needed for recent opam version"
    - opam install -y sasa lutin rdbgui4sasa
  allow_failure: true
  only:
    - master



# 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



pages:
  image: gricad-registry.univ-grenoble-alpes.fr/verimag/synchrone/tools-distrib/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