|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -ACTION="$1" |
4 | | - |
5 | 3 | set -eu |
6 | 4 |
|
7 | 5 | CACHEDIR="$HOME/cache" |
8 | 6 | NPROC=$(nproc) |
9 | | -ASTYLE="$CACHEDIR/astyle/build/gcc/bin/astyle" |
10 | | -ASTYLE_VERSION=3.1 |
11 | | -TRAVIS_TOOL="https://raw.githubusercontent.com/TokTok/ci-tools/master/bin/travis-haskell" |
12 | | - |
13 | | -travis_install() { |
14 | | - bash <(curl -s "$TRAVIS_TOOL") download |
15 | | - travis-haskell download TokTok/hs-tokstyle tokstyle "$HOME/.local" |
16 | | - |
17 | | - which coveralls || { |
18 | | - # Install cpp-coveralls to upload test coverage results. |
19 | | - pip install --user ndg-httpsclient urllib3[secure] cpp-coveralls |
20 | | - |
21 | | - # Work around https://github.com/eddyxu/cpp-coveralls/issues/108 by manually |
22 | | - # installing the pyOpenSSL module and injecting it into urllib3 as per |
23 | | - # https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2 |
24 | | - sed -i -e '/^import sys$/a import urllib3.contrib.pyopenssl\nurllib3.contrib.pyopenssl.inject_into_urllib3()' "$(which coveralls)" |
25 | | - } |
26 | | - |
27 | | - # Install astyle (version in ubuntu-precise too old). |
28 | | - ([ -f "$ASTYLE" ] && "$ASTYLE" --version | grep "$ASTYLE_VERSION" >/dev/null) || { |
29 | | - wget -O ../astyle.tar.gz "https://deb.debian.org/debian/pool/main/a/astyle/astyle_$ASTYLE_VERSION.orig.tar.gz" |
30 | | - tar -xf ../astyle.tar.gz -C "$CACHEDIR" |
31 | | - make -C "$CACHEDIR/astyle/build/gcc" clean |
32 | | - make -C "$CACHEDIR/astyle/build/gcc" "-j$NPROC" |
33 | | - } |
34 | | -} |
35 | | - |
36 | | -run_static_analysis() { |
37 | | - pylint3 -E other/analysis/check_recursion |
38 | | - |
39 | | - export CPPFLAGS="-isystem $CACHEDIR/include" |
40 | | - export LDFLAGS="-L$CACHEDIR/lib" |
41 | | - other/analysis/run-check_recursion |
42 | | - other/analysis/run-clang |
43 | | - other/analysis/run-clang-analyze |
44 | | -} |
45 | | - |
46 | | -travis_script() { |
47 | | - . ".travis/flags-$CC.sh" |
48 | | - |
49 | | - add_ld_flag -Wl,-z,defs |
50 | | - |
51 | | - # Make compilation error on a warning |
52 | | - add_flag -Werror |
53 | | - |
54 | | - # Coverage flags. |
55 | | - add_flag -fprofile-arcs -ftest-coverage |
56 | 7 |
|
57 | | - "$ASTYLE" --version |
58 | | - other/astyle/format-source . "$ASTYLE" |
| 8 | +sudo apt-get install -y --no-install-recommends libopus-dev libsodium-dev libvpx-dev ninja-build |
59 | 9 |
|
60 | | - echo "Running TokTok style checker" |
61 | | - "$HOME/.local/bin/check-cimple" |
| 10 | +. ".travis/flags-$CC.sh" |
62 | 11 |
|
63 | | - # Use () to run in a separate process so the exports are local. |
64 | | - (run_static_analysis) |
| 12 | +add_ld_flag -Wl,-z,defs |
65 | 13 |
|
66 | | - other/analysis/check_logger_levels |
| 14 | +# Make compilation error on a warning |
| 15 | +add_flag -Werror |
67 | 16 |
|
68 | | - cmake -B_build -H. -GNinja \ |
69 | | - -DCMAKE_C_FLAGS="$C_FLAGS" \ |
70 | | - -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \ |
71 | | - -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \ |
72 | | - -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \ |
73 | | - -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \ |
74 | | - -DMIN_LOGGER_LEVEL=TRACE \ |
75 | | - -DMUST_BUILD_TOXAV=ON \ |
76 | | - -DNON_HERMETIC_TESTS=ON \ |
77 | | - -DSTRICT_ABI=ON \ |
78 | | - -DTEST_TIMEOUT_SECONDS=120 \ |
79 | | - -DUSE_IPV6=OFF \ |
80 | | - -DAUTOTEST=ON |
| 17 | +# Coverage flags. |
| 18 | +add_flag -fprofile-arcs -ftest-coverage |
81 | 19 |
|
82 | | - cmake --build _build --parallel "$NPROC" --target install -- -k 0 |
| 20 | +cmake -B_build -H. -GNinja \ |
| 21 | + -DCMAKE_C_FLAGS="$C_FLAGS" \ |
| 22 | + -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \ |
| 23 | + -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \ |
| 24 | + -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \ |
| 25 | + -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \ |
| 26 | + -DMIN_LOGGER_LEVEL=TRACE \ |
| 27 | + -DMUST_BUILD_TOXAV=ON \ |
| 28 | + -DNON_HERMETIC_TESTS=OFF \ |
| 29 | + -DSTRICT_ABI=ON \ |
| 30 | + -DTEST_TIMEOUT_SECONDS=120 \ |
| 31 | + -DUSE_IPV6=OFF \ |
| 32 | + -DAUTOTEST=ON |
83 | 33 |
|
84 | | - cd _build # pushd |
85 | | - ctest -j50 --output-on-failure || |
86 | | - ctest -j50 --output-on-failure --rerun-failed |
87 | | - cd - # popd |
88 | | -} |
| 34 | +cmake --build _build --parallel "$NPROC" --target install -- -k 0 |
89 | 35 |
|
90 | | -if [ "-z" "$ACTION" ]; then |
91 | | - "travis_script" |
92 | | -else |
93 | | - "travis_$ACTION" |
94 | | -fi |
| 36 | +cd _build # pushd |
| 37 | +ctest -j50 --output-on-failure || |
| 38 | + ctest -j50 --output-on-failure --rerun-failed |
| 39 | +cd - # popd |
0 commit comments