Blame .travis.yml

Packit 40c2f1
# Travis CI configuration file
Packit 40c2f1
Packit 40c2f1
sudo: false
Packit 40c2f1
Packit 40c2f1
language: c
Packit 40c2f1
Packit 40c2f1
git:
Packit 40c2f1
  # Set to 10 instead of 1 to avoid problems when the most recent commits have [skip ci]
Packit 40c2f1
  depth: 10
Packit 40c2f1
Packit 40c2f1
# Install autopoint on Ubuntu (needed for gettext)
Packit 40c2f1
# This is ignored on bionic for some reason (see below).
Packit 40c2f1
addons:
Packit 40c2f1
  apt:
Packit 40c2f1
    packages:
Packit 40c2f1
    - autopoint
Packit 40c2f1
Packit 40c2f1
env:
Packit 40c2f1
  # More configurations are configured in the matrix section
Packit 40c2f1
  matrix:
Packit 40c2f1
    - CONFIG=normal
Packit 40c2f1
    - CONFIG=c90
Packit 40c2f1
    - CONFIG=stackprotect
Packit 40c2f1
    - CONFIG=disable-nls
Packit 40c2f1
  global:
Packit 40c2f1
    - MAKEFLAGS='-j 2'
Packit 40c2f1
Packit 40c2f1
compiler:
Packit 40c2f1
  - clang
Packit 40c2f1
  - gcc
Packit 40c2f1
Packit 40c2f1
os:
Packit 40c2f1
  - linux
Packit 40c2f1
  - osx
Packit 40c2f1
Packit 40c2f1
matrix:
Packit 40c2f1
  include:
Packit 40c2f1
  - env: CONFIG=normal DIST=bionic
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: bionic
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
  - env: CONFIG=normal DIST=bionic
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: bionic
Packit 40c2f1
    compiler: clang
Packit 40c2f1
  - env: CONFIG=clang6 DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: clang
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - clang-6.0
Packit 40c2f1
  - env: CONFIG=clang8 DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: clang
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        sources:
Packit 40c2f1
          - llvm-toolchain-trusty-8
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - clang-8
Packit 40c2f1
  - env: CONFIG=clang9 DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: clang
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        sources:
Packit 40c2f1
          sourceline:
Packit 40c2f1
            - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main
Packit 40c2f1
          key_url:
Packit 40c2f1
            - https://apt.llvm.org/llvm-snapshot.gpg.key
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - clang-9
Packit 40c2f1
  - env: CONFIG=clang10 DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: clang
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        sources:
Packit 40c2f1
          sourceline:
Packit 40c2f1
            - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
Packit 40c2f1
          key_url:
Packit 40c2f1
            - https://apt.llvm.org/llvm-snapshot.gpg.key
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - clang-10
Packit 40c2f1
  - env: CONFIG=gcc8 DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        sources:
Packit 40c2f1
          sourceline:
Packit 40c2f1
            - ppa:ubuntu-toolchain-r/test
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - g++-8
Packit 40c2f1
  - env: CONFIG=gcc9 DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        sources:
Packit 40c2f1
          sourceline:
Packit 40c2f1
            - ppa:ubuntu-toolchain-r/test
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - g++-9
Packit 40c2f1
  - env: CONFIG=arm-cross DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - gcc-4.8-arm-linux-gnueabihf
Packit 40c2f1
          - libc6-dev-armhf-cross
Packit 40c2f1
  - env: CONFIG=musl DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - musl-tools
Packit 40c2f1
  - env: CONFIG=sanitize DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: clang
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        sources:
Packit 40c2f1
          sourceline:
Packit 40c2f1
            - deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main
Packit 40c2f1
          key_url:
Packit 40c2f1
            - https://apt.llvm.org/llvm-snapshot.gpg.key
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - clang-10
Packit 40c2f1
          - libtool
Packit 40c2f1
    # Required for -fsanitize=undefined
Packit 40c2f1
    # see https://github.com/travis-ci/travis-ci/issues/9033
Packit 40c2f1
    sudo: required
Packit 40c2f1
  - env: CONFIG=coverage DIST=xenial
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: xenial
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
    addons:
Packit 40c2f1
      apt:
Packit 40c2f1
        packages:
Packit 40c2f1
          - autopoint
Packit 40c2f1
          - libpopt-dev
Packit 40c2f1
          - subversion
Packit 40c2f1
    cache:
Packit 40c2f1
      directories:
Packit 40c2f1
        - $HOME/failmalloc
Packit 40c2f1
  - env: CONFIG=normal DIST=bionic
Packit 40c2f1
    arch: arm64
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: bionic
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
  - env: CONFIG=normal DIST=bionic
Packit 40c2f1
    arch: ppc64le
Packit 40c2f1
    os: linux
Packit 40c2f1
    dist: bionic
Packit 40c2f1
    compiler: gcc
Packit 40c2f1
Packit 40c2f1
before_install:
Packit 40c2f1
  # The apt addons section is ignored on bionic for some reason
Packit 40c2f1
  - if [ "$DIST" = "bionic" ] ; then sudo apt-get install -y autopoint gettext libtool; fi
Packit 40c2f1
Packit 40c2f1
install:
Packit 40c2f1
  - |
Packit 40c2f1
    if [ "$CONFIG" = "coverage" ] ; then
Packit 40c2f1
      set -e
Packit 40c2f1
      pip install --user cpp-coveralls
Packit 40c2f1
      cd "$HOME"
Packit 40c2f1
      git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
Packit 40c2f1
      cd libexif-testsuite
Packit 40c2f1
      mkdir src
Packit 40c2f1
      ln -s "$TRAVIS_BUILD_DIR" src/libexif
Packit 40c2f1
      ./build-config.sh
Packit 40c2f1
      autoreconf -sivf
Packit 40c2f1
      cd "$HOME"
Packit 40c2f1
      # Failmalloc for improved test coverage
Packit 40c2f1
      if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
Packit 40c2f1
        curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
Packit 40c2f1
        tar xaf failmalloc-1.0.tar.gz
Packit 40c2f1
        cd failmalloc-1.0
Packit 40c2f1
        # Fix compiling with modern glibc
Packit 40c2f1
        sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
Packit 40c2f1
        # Disable failmalloc on program exit so system code can run unimpeded
Packit 40c2f1
        sed -i -e '/failmalloc_init/,${/failmalloc_install/aatexit(failmalloc_uninstall);
Packit 40c2f1
        }' failmalloc.c
Packit 40c2f1
        ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
Packit 40c2f1
        make
Packit 40c2f1
        make install
Packit 40c2f1
      fi
Packit 40c2f1
      cd "$TRAVIS_BUILD_DIR"
Packit 40c2f1
    fi
Packit 40c2f1
Packit 40c2f1
script:
Packit 40c2f1
  # Ensure brew gettext is in the PATH so autopoint is found on OS X
Packit 40c2f1
  - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
Packit 40c2f1
  - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
Packit 40c2f1
  - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
Packit 40c2f1
  - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
Packit 40c2f1
  - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
Packit 40c2f1
  - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
Packit 40c2f1
  - if [ "$CONFIG" = "clang8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-8; fi
Packit 40c2f1
  - if [ "$CONFIG" = "clang9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-9; fi
Packit 40c2f1
  - if [ "$CONFIG" = "clang10" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=clang-10; fi
Packit 40c2f1
  - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -Wno-error=implicit-fallthrough -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=gcc-8; fi
Packit 40c2f1
  - if [ "$CONFIG" = "gcc9" ] ; then CFLAGS='-Wall -Wextra -Wno-error=switch -Wno-error=implicit-fallthrough -O3'; MAKE_OPTS="CFLAGS+=-Werror CFLAGS+=${CFLAGS// / CFLAGS+=}"; export CC=gcc-9; fi
Packit 40c2f1
  - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
Packit 40c2f1
  - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
Packit 40c2f1
  - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-10; export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=1; fi
Packit 40c2f1
  - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib"; fi
Packit 40c2f1
  - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -n 300 config.log; false; }
Packit 40c2f1
Packit 40c2f1
  - make V=1 $MAKE_OPTS
Packit 40c2f1
  # Skip tests when cross compiling.
Packit 40c2f1
  - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 $MAKE_OPTS check || { tail -n 300 test*/test-suite.log src/libexif/test*/test-suite.log; false; }; fi
Packit 40c2f1
  - make V=1 $MAKE_OPTS install
Packit 40c2f1
Packit 40c2f1
  - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
Packit 40c2f1
Packit 40c2f1
after_success:
Packit 40c2f1
  - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi