language: c
os: linux
dist: bionic
addons:
  apt:
    packages:
      - libtool-bin
env:
  global:
    - MARGS="-j2"
matrix:
  include:
    - name: Default
    - name: Static
      env: CONFIG="--enable-static"
    - name: Maintainer-mode
      env: CONFIG="--enable-maintainer-mode"
    - name: Pool-debug
      env: CONFIG="--enable-pool-debug"
    - name: Pool-debug, maintainer-mode
      env: CONFIG="--enable-pool-debug --enable-maintainer-mode"
    - name: Maintainer-mode, no IPv6
      env: CONFIG="--enable-maintainer-mode --disable-ipv6"
    - name: Maintainer-mode, -Werror
      env: NOTEST_CFLAGS=-Werror
           CONFIG="--enable-maintainer-mode"
    - name: Maintainer-mode, -Werror (Xenial)
      dist: xenial
      env: NOTEST_CFLAGS=-Werror
           CONFIG="--enable-maintainer-mode"
    - name: Maintainer-mode, -Werror (Focal)
      dist: focal
      env: NOTEST_CFLAGS=-Werror
           CONFIG="--enable-maintainer-mode"
    - name: GCC 10, maintainer-mode, -Werror (Focal)
      dist: focal
      env: CC=gcc-10
           NOTEST_CFLAGS="-Werror -O2"
           CONFIG="--enable-maintainer-mode"
      addons:
        apt:
          sources:
            - sourceline: 'ppa:ubuntu-toolchain-r/test'
          packages:
            - libtool-bin
            - gcc-10
    - name: GCC-10, ASan (Focal)
      dist: focal
      # w/o ODBC since DSO unload leaks memory and fails the tests
      env: CC=gcc-10
           NOTEST_CFLAGS="-fsanitize=address -fno-sanitize-recover=address -fno-omit-frame-pointer -Werror -O2"
           CONFIG="--with-odbc=no"
      addons:
        apt:
          sources:
            - sourceline: 'ppa:ubuntu-toolchain-r/test'
          packages:
            - libtool-bin
            - gcc-10
    - name: GCC-10, ASan, pool-debug (Focal)
      dist: focal
      # w/o ODBC since DSO unload leaks memory and fails the tests
      env: CC=gcc-10
           NOTEST_CFLAGS="-fsanitize=address -fno-sanitize-recover=address -fno-omit-frame-pointer -Werror -O2"
           CONFIG="--enable-pool-debug --with-odbc=no"
      addons:
        apt:
          sources:
            - sourceline: 'ppa:ubuntu-toolchain-r/test'
          packages:
            - libtool-bin
            - gcc-10
    - name: GCC-10, UBsan (Focal)
      dist: focal
      env: CC=gcc-10
           NOTEST_CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer -Werror -O2"
      addons:
        apt:
          sources:
            - sourceline: 'ppa:ubuntu-toolchain-r/test'
          packages:
            - libtool-bin
            - gcc-10

before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'

script: ./buildconf && ./configure $CONFIG && make $MARGS && make check
