dist: bionic
language: c

env:
  global:
    - MAKEFLAGS="-j 2"  # parallelize compilation process

matrix:
  include:
    - name: "gcc 10"
      env: MATRIX_ENV="CC=gcc-10 CXX=g++-10"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-10
    - name: "gcc 9"
      env: MATRIX_ENV="CC=gcc-9 CXX=g++-9"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-9
    - name: "gcc 8"
      env: MATRIX_ENV="CC=gcc-8 CXX=g++-8"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-8
    - name: "gcc 7"
      env: MATRIX_ENV="CC=gcc-7 CXX=g++-7"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-7
    - name: "gcc 6"
      env: MATRIX_ENV="CC=gcc-6 CXX=g++-6"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-6
    - name: "gcc 5"
      dist: xenial
      env: MATRIX_ENV="CC=gcc-5 CXX=g++-5"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
    - name: "gcc 4.9"
      dist: xenial
      env: MATRIX_ENV="CC=gcc-4.9 CXX=g++-4.9"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-4.9

before_install:
  - eval "${MATRIX_ENV}"

before_script:
  - ./autogen.sh
  - ./configure CPPFLAGS=-Werror

script:
  - make -k
  - ./numactl --show
  - make -k check VERBOSE=1 TESTS='test/distance test/nodemap test/numademo test/tbitmap'
  - make distcheck LOG_COMPILER='sh -c "exit 77"'
