sudo: required
dist: trusty

services:
  - docker

language: cpp

env:
  matrix:
    - COMPILER=gcc;   LCG_RELEASE=LCG_96; STANDARD=17; COMPILER_VERSION=gcc8
    - COMPILER=clang; LCG_RELEASE=LCG_96; STANDARD=17; COMPILER_VERSION=clang8
    - COMPILER=gcc;   LCG_RELEASE=LCG_96; STANDARD=14; COMPILER_VERSION=gcc62

before_install:
  - wget --no-check-certificate https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb
  - sudo dpkg -i cvmfs-release-latest_all.deb
  - sudo apt-get update
  - sudo apt-get install cvmfs cvmfs-config-default
  - rm -f cvmfs-release-latest_all.deb
  - wget --no-check-certificate https://lcd-data.web.cern.ch/lcd-data/CernVM/default.local
  - sudo mkdir -p /etc/cvmfs
  - sudo mv default.local /etc/cvmfs/default.local
  - sudo /etc/init.d/autofs stop
  - sudo cvmfs_config setup
  - sudo mkdir -p /cvmfs/sft.cern.ch
  - sudo mkdir -p /cvmfs/geant4.cern.ch
  - sudo mkdir -p /cvmfs/clicdp.cern.ch
  - sudo mount -t cvmfs sft.cern.ch /cvmfs/sft.cern.ch
  - sudo mount -t cvmfs geant4.cern.ch /cvmfs/geant4.cern.ch
  - sudo mount -t cvmfs clicdp.cern.ch /cvmfs/clicdp.cern.ch
  - ls /cvmfs/sft.cern.ch
  - ls /cvmfs/geant4.cern.ch
  - ls /cvmfs/clicdp.cern.ch

# command to install dependencies
install:
  - shopt -s extglob dotglob
  - mkdir Package
  - mv !(Package) Package
  - shopt -u dotglob
  - export PKGDIR=${PWD}/Package

# command to run tests
script:
  - docker run -ti --name CI_container -v $PKGDIR:/DD4hep -e COMPILER_TYPE=$COMPILER -e LCG_RELEASE=${LCG_RELEASE} -e STANDARD=${STANDARD} -e COMPILER_VERSION=${COMPILER_VERSION} -v /cvmfs/sft.cern.ch:/cvmfs/sft.cern.ch -v /cvmfs/geant4.cern.ch:/cvmfs/geant4.cern.ch -v /cvmfs/clicdp.cern.ch:/cvmfs/clicdp.cern.ch -d clicdp/cc7-lcg /bin/bash
  - docker exec -ti CI_container /bin/bash -c "./DD4hep/.dd4hep-ci.d/compile_and_test.sh"
  - if [[ "${TRAVIS_EVENT_TYPE}" != "cron" && "${TRAVIS_EVENT_TYPE}" != "pull_request" && "${COMPILER}" == "gcc" && "${TRAVIS_REPO_SLUG%/*}" == "AIDASoft" ]];
    then curl -X POST -F token=$GITLAB_TOKEN -F ref=master https://gitlab.cern.ch/api/v4/projects/7828/trigger/pipeline;
    fi

# Don't send e-mail notifications
notifications:
  email: false
