dist: trusty
sudo: required

language: cpp

services:
  - docker

before_install:
  - sudo wget -q https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose

jobs:
  fast_finish: true
  allow_failures:
    - env: TARGET=ipk
  include:
    - &run-with-clang-minimal
      stage: Clang 3.8 - minimal with unit tests
      env:
        - TARGET=minimal
        - CMAKE_BUILD_TYPE=Debug
      before_script: docker-compose pull ${TARGET}
      script:
        - export CC=clang-3.8 CXX=clang++-3.8
        - docker-compose run ${TARGET}
    - <<: *run-with-clang-minimal
      env:
        - TARGET=minimal
        - CMAKE_BUILD_TYPE=Release
    - &run-with-clang
      stage: Clang 3.8
      env: TARGET=python
      before_script: docker-compose pull ${TARGET}
      script:
        - export CC=clang-3.8 CXX=clang++-3.8
        - docker-compose run ${TARGET}
    - <<: *run-with-clang
      env: TARGET=node4
    - <<: *run-with-clang
      env: TARGET=node5
    - <<: *run-with-clang
      env: TARGET=node6
    - <<: *run-with-clang
      env: TARGET=java
    - &run-with-gcc-5
      stage: Gcc 5
      env: TARGET=python
      before_script: docker-compose pull ${TARGET}
      script:
        - export CC=gcc-5 CXX=g++-5
        - docker-compose run ${TARGET}
    - <<: *run-with-gcc-5
      env: TARGET=node4
    - <<: *run-with-gcc-5
      env: TARGET=node5
    - <<: *run-with-gcc-5
      env: TARGET=node6
    - <<: *run-with-gcc-5
      env: TARGET=java
    - &run-with-gcc-6
      stage: Gcc 6
      env: TARGET=python
      before_script: docker-compose pull ${TARGET}
      script:
        - export CC=gcc-6 CXX=g++-6
        - docker-compose run ${TARGET}
    - <<: *run-with-gcc-6
      env: TARGET=node4
    - <<: *run-with-gcc-6
      env: TARGET=node5
    - <<: *run-with-gcc-6
      env: TARGET=node6
    - <<: *run-with-gcc-6
      env: TARGET=java
    - &run-additional-jobs
      stage: Additional Jobs
      env: TARGET=doc
      before_script: docker-compose pull ${TARGET}
      script:
        - export CC=clang-3.8 CXX=clang++-3.8
        - docker-compose run ${TARGET}
    - <<: *run-additional-jobs
      env: TARGET=android
    - <<: *run-additional-jobs
      env: TARGET=cordova
    - <<: *run-additional-jobs
      env: TARGET=examples
    - <<: *run-additional-jobs
      env: TARGET=sonar-scan
    - <<: *run-additional-jobs
      env: TARGET=ipk
    - <<: *run-additional-jobs
      env: TARGET=rpm
    - <<: *run-additional-jobs
      env: TARGET=npm
