language: c
sudo: required
python:
 - "3.5"

env:
  global:
    - GAPROOT=gaproot
    - COVDIR=coverage

addons:
  apt:
   update: true

  apt_packages:
    - libgmp-dev
    - libreadline-dev
    - libgmp-dev:i386
    - libreadline-dev:i386
    - gcc-multilib
    - g++-multilib
    - libzmq3-dev
    - libzmq3-dev:i386
    - python3
    - python3-pip

matrix:
  include:
    - env: CFLAGS="-O2" CC=clang CXX=clang++
      compiler: clang
    - env: CFLAGS="-O2"
      compiler: gcc
    - env: CFLAGS=""  # test build w/o optimization

branches:
  only:
    - master

before_script:
  - scripts/build_gap.sh
script:
  - scripts/build_pkg.sh
  - scripts/run_tests.sh
after_script:
  - bash scripts/gather-coverage.sh
  - bash <(curl -s https://codecov.io/bash)
