language: c
env:
  - OCAML_VERSION=4.02.1 OPAM_VERSION=1.2.0
  - OCAML_VERSION=4.01.0 OPAM_VERSION=1.2.0

before_install:
  - until sudo add-apt-repository -y ppa:saiarcot895/chromium-beta; do echo retry; done
  - until sudo add-apt-repository --yes ppa:kalakris/cmake; do echo retry; done
  - until sudo apt-get -qq update; do echo retry; done
  - until sudo apt-get install cmake; do echo retry; done
  - OPAM_DEPENDS="ocamlgraph ocamlfind"
  - chmod +x ./.ocaml-config.sh
  - sudo -E ./.ocaml-config.sh

install:
  - sudo apt-get update -qq
  - sudo apt-get install -qq ocaml opam
  - export OPAMYES=1
  - opam init
  - opam install ${OPAM_DEPENDS}
  - eval `opam config env`
  - export LZ="$TRAVIS_BUILD_DIR/../zustre"
  - git clone https://github.com/coco-team/zustre $LZ
  - ls $LZ
  - export Z3="$TRAVIS_BUILD_DIR/../z3"
  - mkdir -p $Z3
  - wget --output-document=zustre.tar.gz https://www.dropbox.com/s/9cvef743630rten/zustre.tar.gz?dl=1;
  - tar xvf zustre.tar.gz --strip-components=1 -C $Z3;
  - ls $LZ
  - ls $Z3

before_script:
  - ocaml -version
  - opam --version

script:
  - autoconf
  - ./configure
  - make
  - ./bin/lustrec
  - cd $LZ
  - mkdir -p build
  - cd build
  - /usr/bin/cmake -DLUSTREC_EXECUTABLE=/home/travis/build/coco-team/lustrec/bin/lustrec -DZ3_ROOT=$Z3 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=run -DCMAKE_PROGRAM_PATH=/usr/bin  ../;
  - /usr/bin/cmake --build .
  - /usr/bin/cmake --build . --target install
  - cd ..
  - ls build/run/bin
  - ./build/run/bin/zustre -h
  -  python src/reg_test.py ./build/run/bin/zustre




notifications:
  email:
    recipients:
     - lustrec-build@googlegroups.com
    on_success: always
    on_failure: always
