File: travis.sh

package info (click to toggle)
rtags 2.41-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,768 kB
  • sloc: cpp: 51,883; lisp: 5,389; ansic: 1,637; sh: 563; python: 305; objc: 81; makefile: 29
file content (78 lines) | stat: -rwxr-xr-x 2,444 bytes parent folder | download
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
#!/bin/bash -e
# travis.sh --- setup and compile script for travis
#
# Copyright (c) Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>
# Author: Christian Schwarzgruber
# Created: Tue May 10 22:28:28 2016 (+0200)
#
# This file is part of RTags (https://github.com/Andersbakken/rtags).
#
# RTags is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# RTags is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with RTags.  If not, see <https://www.gnu.org/licenses/>. */
#
# Description: The following variables can be changed from the build matrix:
#  - ASAN        (default value is "1")
declare -a CMAKE_PARAMS=("-DCMAKE_CXX_COMPILER=$CXX$COMPILER_VERSION"
                         "-DCMAKE_C_COMPILER=$CC$COMPILER_VERSION"
                         "-DWITH_TESTS=1")

if [ "$ASAN" ]; then
    CMAKE_PARAMS+=("-DASAN=address,undefined")
fi

export CCACHE_DEBUG=1
function build_and_test()
{
    cmake_args=$1; shift
    mkdir build
    cd build
    cmake "$cmake_args" "${CMAKE_PARAMS[@]}" .. || cat CMakeFiles/CMakeError.log
    make VERBOSE=1 -j2
    PATH=$PATH:$(pwd)/bin
    ctest --output-on-failure --verbose "$@"
}

function add_cmake_params()
{
    for param in "$@"; do
        CMAKE_PARAMS[${#CMAKE_PARAMS[@]}]="$param"
    done
}

function osx()
{
    mkdir -p ~/.local/bin
    export LIBCLANG_LLVM_CONFIG_EXECUTABLE=$(find /usr/local/Cellar/llvm/*/bin -name llvm-config 2>/dev/null)
    # Help cmake to find openssl includes/library
    add_cmake_params "-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"

    # Note sure why the "elisptests" target is generated even though Emacs is to old (Works locally) :/
    build_and_test -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -E elisp
}

function gnu_linux()
{
    build_and_test -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
}

pip3 install --user --upgrade wheel setuptools
pip3 install --user --upgrade pytest

if [ $TRAVIS_OS_NAME = osx ]; then
    export PATH=$PATH:$(python3 -c 'import site; print(site.USER_BASE)')/bin
    osx
else
    gnu_linux
fi

exit 0