Reformatted the matrix section of the Travis config file.
[platform/upstream/libexif.git] / .travis.yml
1 # Travis CI configuration file
2
3 sudo: false
4
5 language: c
6
7 git:
8   depth: 1
9
10 # Install autopoint on Ubuntu (needed for gettext)
11 addons:
12   apt:
13     packages:
14     - autopoint
15
16 env:
17   # More configurations are configured in the matrix section
18   matrix:
19     - CONFIG=normal
20     - CONFIG=c90
21     - CONFIG=stackprotect
22   global:
23     - MAKEFLAGS='-j 2'
24
25 compiler:
26   - clang
27   - gcc
28
29 os:
30   - linux
31   - osx
32
33 matrix:
34   include:
35   - env: CONFIG=clang6
36     os: linux
37     compiler: clang
38     addons:
39       apt:
40         sources:
41           - llvm-toolchain-trusty-6.0
42           - ubuntu-toolchain-r-test
43         packages:
44           - autopoint
45           - clang-6.0
46   - env: CONFIG=gcc8
47     os: linux
48     compiler: gcc
49     addons:
50       apt:
51         sources:
52           - ubuntu-toolchain-r-test
53         packages:
54           - autopoint
55           - g++-8
56   - env: CONFIG=arm-cross
57     os: linux
58     compiler: gcc
59     addons:
60       apt:
61         packages:
62           - autopoint
63           - gcc-4.8-arm-linux-gnueabihf
64           - libc6-dev-armhf-cross
65   - env: CONFIG=sanitize
66     os: linux
67     addons:
68       apt:
69         sources:
70           - llvm-toolchain-trusty-6.0
71           - ubuntu-toolchain-r-test
72         packages:
73           - autopoint
74           - clang-6.0
75           - libtool
76     compiler: clang
77     # Required for -fsanitize=undefined
78     # see https://github.com/travis-ci/travis-ci/issues/9033
79     sudo: required
80   - env: CONFIG=coverage
81     os: linux
82     compiler: gcc
83     addons:
84       apt:
85         packages:
86           - autopoint
87           - libpopt-dev
88           - subversion
89     cache:
90       directories:
91         - $HOME/failmalloc
92
93 install:
94   - |
95     if [ "$CONFIG" = "coverage" ] ; then
96       set -e
97       pip install --user cpp-coveralls
98       cd "$HOME"
99       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
100       cd libexif-testsuite
101       mkdir src
102       ln -s "$TRAVIS_BUILD_DIR" src/libexif
103       ./build-config.sh
104       autoreconf -sivf
105       cd "$HOME"
106       # Failmalloc for improved test coverage
107       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
108         curl -fsSORL https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
109         tar xaf failmalloc-1.0.tar.gz
110         cd failmalloc-1.0
111         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
112         ./configure --prefix="$HOME/failmalloc"
113         make
114         make install
115       fi
116       cd "$TRAVIS_BUILD_DIR"
117     fi
118
119 script:
120   # Ensure brew gettext is in the PATH so autopoint is found on OS X
121   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
122   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
123   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
124   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
125   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
126   - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=gcc-8; fi
127   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
128   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined'; export CC=clang-6.0; fi
129   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi
130   - ./configure --prefix="${HOME}"/install CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; }
131
132   - make V=1
133   # Skip tests when cross compiling.
134   - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi
135   - make V=1 install
136
137   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
138
139 after_success:
140   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi