Added a clang-7 Travis build configuration.
[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=clang7
47     os: linux
48     compiler: clang
49     addons:
50       apt:
51         sources:
52           - llvm-toolchain-trusty-7
53           - ubuntu-toolchain-r-test
54         packages:
55           - autopoint
56           - clang-7
57   - env: CONFIG=gcc8
58     os: linux
59     compiler: gcc
60     addons:
61       apt:
62         sources:
63           - ubuntu-toolchain-r-test
64         packages:
65           - autopoint
66           - g++-8
67   - env: CONFIG=arm-cross
68     os: linux
69     compiler: gcc
70     addons:
71       apt:
72         packages:
73           - autopoint
74           - gcc-4.8-arm-linux-gnueabihf
75           - libc6-dev-armhf-cross
76   - env: CONFIG=musl
77     os: linux
78     compiler: gcc
79     addons:
80       apt:
81         packages:
82           - autopoint
83           - musl-tools
84   - env: CONFIG=sanitize
85     os: linux
86     compiler: clang
87     addons:
88       apt:
89         sources:
90           - llvm-toolchain-trusty-7
91           - ubuntu-toolchain-r-test
92         packages:
93           - autopoint
94           - clang-7
95           - libtool
96     # Required for -fsanitize=undefined
97     # see https://github.com/travis-ci/travis-ci/issues/9033
98     sudo: required
99   - env: CONFIG=coverage
100     os: linux
101     compiler: gcc
102     addons:
103       apt:
104         packages:
105           - autopoint
106           - libpopt-dev
107           - subversion
108     cache:
109       directories:
110         - $HOME/failmalloc
111
112 install:
113   - |
114     if [ "$CONFIG" = "coverage" ] ; then
115       set -e
116       pip install --user cpp-coveralls
117       cd "$HOME"
118       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
119       cd libexif-testsuite
120       mkdir src
121       ln -s "$TRAVIS_BUILD_DIR" src/libexif
122       ./build-config.sh
123       autoreconf -sivf
124       cd "$HOME"
125       # Failmalloc for improved test coverage
126       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
127         curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
128         tar xaf failmalloc-1.0.tar.gz
129         cd failmalloc-1.0
130         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
131         ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
132         make
133         make install
134       fi
135       cd "$TRAVIS_BUILD_DIR"
136     fi
137
138 script:
139   # Ensure brew gettext is in the PATH so autopoint is found on OS X
140   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
141   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
142   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
143   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
144   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
145   - if [ "$CONFIG" = "clang7" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-7; fi
146   - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=gcc-8; fi
147   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
148   - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
149   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-7; export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1; fi
150   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi
151   - ./configure --prefix="${HOME}"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; }
152
153   - make V=1
154   # Skip tests when cross compiling.
155   - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi
156   - make V=1 install
157
158   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
159
160 after_success:
161   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi