]> git.sur5r.net Git - i3/i3/blob - .travis.yml
Merge pull request #2061 from Airblader/bug-2049
[i3/i3] / .travis.yml
1 language: c
2 compiler:
3   - gcc
4   - clang
5 addons:
6   apt:
7     sources:
8     - llvm-toolchain-precise-3.5
9     # ubuntu-toolchain-r-test contains libstdc++6 >= 4.8 which libllvm3.5 needs.
10     - ubuntu-toolchain-r-test
11     packages:
12     - clang-format-3.5
13     - libllvm3.5
14 before_install:
15   # The travis VMs run on Ubuntu 12.04 which is very old and a huge pain to get
16   # into a state where we can build a recent version of i3 :(.
17   - "echo 'deb http://archive.ubuntu.com/ubuntu/ trusty main universe' | sudo tee /etc/apt/sources.list.d/trusty.list"
18   - "echo 'APT::Default-Release \"precise\";' | sudo tee /etc/apt/apt.conf.d/default-release"
19
20   - "echo 'Package: libc6' > /tmp/pin"
21   - "echo 'Pin: release n=trusty' >> /tmp/pin"
22   - "echo 'Pin-Priority: 999' >> /tmp/pin"
23   - "echo '' >> /tmp/pin"
24
25   - "echo 'Package: libxkbcommon*' >> /tmp/pin"
26   - "echo 'Pin: release n=trusty' >> /tmp/pin"
27   - "echo 'Pin-Priority: 999' >> /tmp/pin"
28   - "echo '' >> /tmp/pin"
29
30   - "echo 'Package: libyajl*' >> /tmp/pin"
31   - "echo 'Pin: release n=trusty' >> /tmp/pin"
32   - "echo 'Pin-Priority: 999' >> /tmp/pin"
33   - "echo '' >> /tmp/pin"
34
35   - "echo 'Package: libxcb-image*' >> /tmp/pin"
36   - "echo 'Pin: release n=trusty' >> /tmp/pin"
37   - "echo 'Pin-Priority: 999' >> /tmp/pin"
38   - "echo '' >> /tmp/pin"
39
40   - sudo cp /tmp/pin /etc/apt/preferences.d/trustypin
41   - sudo apt-get update
42   - sudo apt-get install -t trusty libc6 libc6-dev
43   - sudo apt-get install --no-install-recommends devscripts equivs xdotool
44 install:
45   - sudo mk-build-deps --install --remove --tool 'apt-get --no-install-recommends' debian/control
46   # Install as many dependencies as possible via apt because cpanm is not very reliable/easy to debug.
47   - sudo apt-get install --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
48   - sudo /bin/sh -c 'cpanm -n -v X11::XCB || true'
49   - sudo /bin/sh -c 'cpanm -n -v AnyEvent::I3 || true'
50 script:
51   - CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j
52   - (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false))
53   - clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
54   - |
55     funcs='malloc|calloc|realloc|strdup|strndup|asprintf|write'
56     cstring='"([^"\\]|\\.)*"'
57     cchar="'[^\\\\]'|'\\\\.[^']*'"
58     regex="^([^'\"]|${cstring}|${cchar})*\<(${funcs})\>"
59     detected=0
60     while IFS= read -r file; do
61         if { cpp -w -fpreprocessed "$file" || exit "$?"; } | grep -E -- "$regex"; then
62             echo "^ $file calls a function that has a safe counterpart."
63             detected=1
64         fi
65     done << EOF
66     $(find -name '*.c' -not -name safewrappers.c -not -name strndup.c)
67     EOF
68     if [ "$detected" -ne 0 ]; then
69         echo
70         echo "Calls of functions that have safe counterparts were detected."
71         exit 1
72     fi