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