os:
  - linux

arch:
  - amd64
  - arm64
  - ppc64le
  - s390x

matrix:
  include:
    # Different distros and compilers on amd64
    - dist: xenial
      compiler: gcc
    - dist: xenial
      compiler: clang
    - dist: bionic
      compiler: gcc
    - dist: bionic
      compiler: clang
    - dist: focal
      compiler: gcc
    - dist: focal
      compiler: clang
    # Different architectures, gcc only
    # We test these b/c Debian and Ubuntu packaging builds them
    - arch: arm64
    - arch: ppc64le
    - arch: s390x

language: c

script:
  - mkdir _build
  - cd _build
  # Test build with stricter flags
  - export CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector -g3 -pedantic -W -Wall -Wbad-function-cast -Wcast-align
      -Wcast-qual -Wdisabled-optimization -Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Winline
      -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-unused-parameter -Wpointer-arith -Wshadow
      -Wstrict-prototypes -Wstack-protector -Wswitch -Wundef -Wwrite-strings -std=c99"
  - cmake .. -DCMAKE_C_FLAGS="$CFLAGS"
  - cmake --build .
  - ctest --verbose
