dist: bionic
sudo: required
language: erlang
matrix:
  include:
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-5
      env:
         - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
    - os: linux
      addons:
        apt:
          sources:
            - llvm-toolchain-bionic-3.9
          packages:
            - clang-3.9
      env:
        - MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
compiler:
  - clang
  - gcc
otp_release:
  - 23.3.1
  - 22.3.4
python:
  - "3.8"
rvm:
  - 2.7.0
services:
  - mysql
  - postgresql
before_install:
  # travis default image has: make autoconf automake libtool g++ git perl python python-dev
  - sudo apt-get install default-jdk ocaml php libboost-system-dev libboost-thread-dev libboost-dev libseccomp-dev libgmp-dev libdwarf-dev libelf-dev
before_script:
  - kerl list installations
  - mkdir build
  - cd build
  - ../src/autogen.sh
  - export ${CONFIGURE_ENV}
  - ../src/configure --with-test-timeout=vm --with-long-test-timeout=yes --prefix=`pwd`/../install_local --enable-ocaml-support
  - mysql -u root -e "CREATE DATABASE cloudi_tests;"
  - mysql -u root -e "CREATE USER 'cloudi_tests'@'localhost' IDENTIFIED BY 'cloudi_tests'; GRANT ALL ON cloudi_tests.* TO cloudi_tests IDENTIFIED BY 'cloudi_tests';"
  - psql -U postgres -c "CREATE DATABASE cloudi_tests;"
  - psql -U postgres -c "CREATE USER cloudi_tests WITH PASSWORD 'cloudi_tests'; GRANT ALL PRIVILEGES ON DATABASE cloudi_tests to cloudi_tests;"
  - gem install test-unit
script:
  - ../src/make_dev test install || ( find ../src/ -mmin 1 \( -name 'raw.log' -o -name 'cloudi.log' \) -printf '%C@ %p\n' | sort -r | cut -d ' ' -f 2 | xargs cat && exit 1 )
  - ../src/make_dev install DESTDIR=`pwd`/../install_pkgdir/
after_script:
  - make distclean
branches:
  only:
    - master
    - develop
notifications:
  email:
    recipients:
      - mjtruog@gmail.com
  irc:
    channels:
      - "irc.oftc.net#cloudi"
    template:
      - "%{repository_slug} (%{branch} - %{commit}) %{author}: %{commit_message}"
      - "View Changes %{compare_url}"
      - "Build #%{build_number}: %{message} (%{build_url})"
