language: d
sudo: false
dist: trusty

services:
  - mongodb
  - redis-server

addons:
  apt:
    packages:
      - pkg-config
      - zlib1g-dev
      - libevent-dev
      - libssl-dev

branches:
  only:
  - master
  - 0.7.x

d:
  # order: latest DMD, oldest DMD, LDC/GDC, remaining DMD versions
  # this way the overall test time gets cut down (GDC/LDC are a lot
  # slower tham DMD, so they should be started early), while still
  # catching most DMD version related build failures early
  - dmd-2.080.0
  - dmd-2.074.1
  - ldc-1.9.0
  - ldc-1.8.0
  - ldc-1.7.0
  - ldc-1.6.0
  - ldc-1.5.0
  - ldc-1.4.0
  - dmd-2.079.1
  - dmd-2.078.3
  - dmd-2.077.1
  - dmd-2.076.1
  - dmd-2.075.1
  - dmd-beta

env:
  - VIBED_DRIVER=libevent PARTS=lint,builds,unittests,examples,tests,meson
  - VIBED_DRIVER=vibe-core PARTS=builds,unittests,examples,tests
  - VIBED_DRIVER=libasync PARTS=builds,unittests

matrix:
  include:
    - d: dmd
      # https://issues.dlang.org/show_bug.cgi?id=13742
      env: DFLAGS="-cov -version=VibedSetCoverageMerge" DUB_BUILD_MODE="singleFile"
  exclude:
    - d: ldc-1.2.0
      env: VIBED_DRIVER=libasync PARTS=builds,unittests
  allow_failures:
    - d: dmd-beta
    - d: ldc-1.3.0
      env: VIBED_DRIVER=libasync PARTS=builds,unittests

before_install:
  - pyenv global system 3.6
  - pip3 install 'meson>=0.44.1'
  # Use the dub-updating fork of the installer script until https://github.com/dlang/installer/pull/301 is merged
  - wget https://raw.githubusercontent.com/wilzbach/installer-dub/master/script/install.sh -O ~/dlang/install.dub.sh
  - . $(bash ~/dlang/install.dub.sh -a dub)
  - dub --version

install:
  - mkdir .ntmp
  - curl -L https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip -o .ntmp/ninja-linux.zip
  - unzip .ntmp/ninja-linux.zip -d .ntmp

before_script:
  - export PATH=$PATH:$PWD/.ntmp

script: ./travis-ci.sh
after_success:
 - bash <(curl -s https://codecov.io/bash)
