]> git.sur5r.net Git - i3/i3/blob - .travis.yml
Merge pull request #2177 from dcoppa/next
[i3/i3] / .travis.yml
1 sudo: required
2 dist: trusty
3 language: c
4 compiler:
5   - gcc
6   - clang
7 addons:
8   apt:
9     sources:
10     - ubuntu-toolchain-r-test
11     packages:
12     - clang-format-3.5
13     - libllvm3.5
14     - clang-3.5
15     - gcc-5
16 before_install:
17   - sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-suggests --no-install-recommends devscripts equivs xdotool
18 install:
19   - sudo DEBIAN_FRONTEND=noninteractive mk-build-deps --install --remove --tool 'apt-get -yq --no-install-suggests --no-install-recommends' debian/control
20   # Install as many dependencies as possible via apt because cpanm is not very reliable/easy to debug.
21   - sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-suggests --no-install-recommends libanyevent-perl libanyevent-i3-perl libextutils-pkgconfig-perl xcb-proto cpanminus xvfb xserver-xephyr xauth libinline-perl libxml-simple-perl libmouse-perl libmousex-nativetraits-perl libextutils-depends-perl perl-modules libtest-deep-perl libtest-exception-perl libxml-parser-perl libtest-simple-perl libtest-fatal-perl libdata-dump-perl libtest-differences-perl libxml-tokeparser-perl libtest-use-ok-perl libipc-run-perl libxcb-xtest0-dev
22   - sudo /bin/sh -c 'cpanm -n -v X11::XCB || true'
23   - sudo /bin/sh -c 'cpanm -n -v AnyEvent::I3 || true'
24 script:
25   - if [ -a .git/shallow ]; then git fetch --unshallow; fi
26   - if [ "$CC" = "clang" ]; then export CC="clang-3.5"; fi
27   - if [ "$CC" = "gcc" ]; then export CC="gcc-5"; fi
28   - CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j ASAN=1
29   - (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false))
30   - clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
31   - |
32     funcs='malloc|calloc|realloc|strdup|strndup|asprintf|write'
33     cstring='"([^"\\]|\\.)*"'
34     cchar="'[^\\\\]'|'\\\\.[^']*'"
35     regex="^([^'\"]|${cstring}|${cchar})*\<(${funcs})\>"
36     detected=0
37     while IFS= read -r file; do
38         if { cpp -w -fpreprocessed "$file" || exit "$?"; } | grep -E -- "$regex"; then
39             echo "^ $file calls a function that has a safe counterpart."
40             detected=1
41         fi
42     done << EOF
43     $(find -name '*.c' -not -name safewrappers.c -not -name strndup.c)
44     EOF
45     if [ "$detected" -ne 0 ]; then
46         echo
47         echo "Calls of functions that have safe counterparts were detected."
48         exit 1
49     fi