aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/ci/setup_travis.sh
blob: 616527e815f7d0db5a90e1f3316bbf7c3a154523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
set -ev
which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if available

git clone --depth 1 https://github.com/randombit/botan-ci-tools

if [ "$TRAVIS_OS_NAME" = "linux" ]; then

    # ccache in Trusty is too old, use version from Xenial
    sudo dpkg -i botan-ci-tools/ubuntu/ccache_3.2.4-1_amd64.deb

    if [ "$BUILD_MODE" = "valgrind" ]; then
        sudo apt-get -qq update
        sudo apt-get install valgrind

    elif [ "$BUILD_MODE" = "cross-win32" ]; then
        # See https://github.com/travis-ci/travis-ci/issues/6460
        sudo dpkg --add-architecture i386
        sudo apt-get -qq update # have to run this after --add-architecture
        sudo apt-get install wine g++-mingw-w64-i686 mingw-w64-i686-dev

    elif [ "${BUILD_MODE:0:5}" = "cross" ]; then
         # Need updated qemu
         sudo add-apt-repository -y ppa:ubuntu-cloud-archive/kilo-staging
         sudo apt-get -qq update
         sudo apt-get install qemu-user

         if [ "$BUILD_MODE" = "cross-arm32" ]; then
             sudo apt-get install g++-arm-linux-gnueabihf libc6-dev-armhf-cross
         elif [ "$BUILD_MODE" = "cross-arm64" ]; then
             sudo apt-get install g++-aarch64-linux-gnu libc6-dev-arm64-cross
         elif [ "$BUILD_MODE" = "cross-ppc32" ]; then
             sudo apt-get install g++-powerpc-linux-gnu libc6-dev-powerpc-cross
         elif [ "$BUILD_MODE" = "cross-ppc64" ]; then
             sudo apt-get install g++-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
         fi

    elif [ "$BUILD_MODE" = "lint" ]; then
        pip install --user pylint

        sudo apt-get install python3-pip
        pip3 install --user pylint

    elif [ "$BUILD_MODE" = "coverage" ]; then
        sudo apt-get -qq update
        sudo apt-get install trousers libtspi-dev

        # need updated lcov for gcc 4.8 coverage format
        sudo dpkg -i botan-ci-tools/ubuntu/lcov_1.12-2_all.deb

        (cd /home/travis/bin && ln -s gcov-4.8 gcov)

        pip install --user coverage
        pip install --user codecov

        # SoftHSMv1 in 14.04 does not work
        # Installs prebuilt SoftHSMv2 binaries into /tmp
        tar -C / -xvjf botan-ci-tools/softhsm2-trusty-bin.tar.bz2
        /tmp/softhsm/bin/softhsm2-util --init-token --free --label test --pin 123456 --so-pin 12345678

    elif [ "$BUILD_MODE" = "sonar" ]; then
        wget https://sonarqube.com/static/cpp/build-wrapper-linux-x86.zip
        unzip build-wrapper-linux-x86.zip

    elif [ "$BUILD_MODE" = "docs" ]; then
        sudo apt-get -qq update
        sudo apt-get install doxygen

        # The version of Sphinx in 14.04 is too old (1.2.2) and does not support
        # all C++ features used in the manual. Install python-requests to avoid
        # problem in Ubuntu packaged version, see
        # http://stackoverflow.com/questions/32779919/no-module-named-for-requests
        sudo apt-get remove python-requests python-openssl
        sudo pip install requests sphinx pyopenssl
    fi

elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
    # Avoid running brew update as it is quite slow, and all we need
    # is any working version of ccache

    # TODO just copy an OS X binary of ccache to botan-ci-tools repo

    #brew update
    brew install ccache
fi