Travis build updates.
[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 # This is ignored on bionic for some reason (see below).
12 addons:
13   apt:
14     packages:
15     - autopoint
16
17 env:
18   # More configurations are configured in the matrix section
19   matrix:
20     - CONFIG=normal
21     - CONFIG=c90
22     - CONFIG=stackprotect
23     - CONFIG=disable-nls
24   global:
25     - MAKEFLAGS='-j 2'
26
27 compiler:
28   - clang
29   - gcc
30
31 os:
32   - linux
33   - osx
34
35 matrix:
36   include:
37   - env: CONFIG=normal DIST=bionic
38     os: linux
39     dist: bionic
40     compiler: gcc
41   - env: CONFIG=normal DIST=bionic
42     os: linux
43     dist: bionic
44     compiler: clang
45   - env: CONFIG=normal DIST=xenial
46     os: linux
47     dist: xenial
48     compiler: gcc
49   - env: CONFIG=normal DIST=xenial
50     os: linux
51     dist: xenial
52     compiler: clang
53   - env: CONFIG=clang6
54     os: linux
55     compiler: clang
56     addons:
57       apt:
58         sources:
59           - llvm-toolchain-trusty-6.0
60           - ubuntu-toolchain-r-test
61         packages:
62           - autopoint
63           - clang-6.0
64   - env: CONFIG=clang8
65     os: linux
66     compiler: clang
67     addons:
68       apt:
69         sources:
70           - llvm-toolchain-trusty-8
71           - ubuntu-toolchain-r-test
72         packages:
73           - autopoint
74           - clang-8
75   - env: CONFIG=gcc8
76     os: linux
77     compiler: gcc
78     addons:
79       apt:
80         sources:
81           - ubuntu-toolchain-r-test
82         packages:
83           - autopoint
84           - g++-8
85   - env: CONFIG=arm-cross
86     os: linux
87     compiler: gcc
88     addons:
89       apt:
90         packages:
91           - autopoint
92           - gcc-4.8-arm-linux-gnueabihf
93           - libc6-dev-armhf-cross
94   - env: CONFIG=musl
95     os: linux
96     compiler: gcc
97     addons:
98       apt:
99         packages:
100           - autopoint
101           - musl-tools
102   - env: CONFIG=sanitize
103     os: linux
104     compiler: clang
105     addons:
106       apt:
107         sources:
108           - llvm-toolchain-trusty-8
109           - ubuntu-toolchain-r-test
110         packages:
111           - autopoint
112           - clang-8
113           - libtool
114     # Required for -fsanitize=undefined
115     # see https://github.com/travis-ci/travis-ci/issues/9033
116     sudo: required
117   - env: CONFIG=coverage
118     os: linux
119     compiler: gcc
120     addons:
121       apt:
122         packages:
123           - autopoint
124           - libpopt-dev
125           - subversion
126     cache:
127       directories:
128         - $HOME/failmalloc
129
130 before_install:
131   # The apt addons section is ignored on bionic for some reason
132   - if [ "$DIST" = "bionic" ] ; then sudo apt-get install -y autopoint; fi
133
134 install:
135   - |
136     if [ "$CONFIG" = "coverage" ] ; then
137       set -e
138       pip install --user cpp-coveralls
139       cd "$HOME"
140       git clone --depth=1 https://github.com/libexif/libexif-testsuite.git
141       cd libexif-testsuite
142       mkdir src
143       ln -s "$TRAVIS_BUILD_DIR" src/libexif
144       ./build-config.sh
145       autoreconf -sivf
146       cd "$HOME"
147       # Failmalloc for improved test coverage
148       if [ ! -e "$HOME/failmalloc/lib/libfailmalloc.so.0" ] ; then
149         curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz
150         tar xaf failmalloc-1.0.tar.gz
151         cd failmalloc-1.0
152         sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c
153         ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking
154         make
155         make install
156       fi
157       cd "$TRAVIS_BUILD_DIR"
158     fi
159
160 script:
161   # Ensure brew gettext is in the PATH so autopoint is found on OS X
162   - PATH="$PATH:/usr/local/opt/gettext/bin" autoreconf -sivf
163   - if [ "$CONFIG" = "normal" ] ; then CFLAGS='-Wall -Wextra -O3'; fi
164   - if [ "$CONFIG" = "c90" ] ; then CFLAGS='-std=iso9899:1990 -D_XOPEN_SOURCE=500 -Wall -Wextra -O3'; fi
165   - if [ "$CONFIG" = "stackprotect" ] ; then CFLAGS='-g -O0 -fstack-protector-all'; fi
166   - if [ "$CONFIG" = "disable-nls" ] ; then CFLAGS='-Wall -Wextra -O3'; CONFIGURE_OPTS='--disable-nls'; fi
167   - if [ "$CONFIG" = "clang6" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-6.0; fi
168   - if [ "$CONFIG" = "clang8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=clang-8; fi
169   - if [ "$CONFIG" = "gcc8" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=gcc-8; fi
170   - if [ "$CONFIG" = "arm-cross" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=arm-linux-gnueabihf-gcc-4.8; CONFIGURE_OPTS='--host=arm-linux-gnueabihf'; fi
171   - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi
172   - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-8; 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
173   - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi
174   - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; }
175
176   - make V=1
177   # Skip tests when cross compiling.
178   - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi
179   - make V=1 install
180
181   - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi
182
183 after_success:
184   - if [ "$CONFIG" = "coverage" ] ; then coveralls --build-root libexif --exclude test --exclude contrib --gcov-options '\-lp'; fi