summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 7df3e4f3a2fad7a2ddfad526778e4d60012f899d (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# build Apache Thrift on Travis CI - https://travis-ci.org/

language: cpp

sudo: required

cache:
 - apt
 - npm
 - maven

compiler:
  - clang
  - gcc

before_install:
  - sh build/travis/installCXXDependencies.sh
  - if [ "$ALL_DEPS" != "no" ] ; then sh build/travis/installDependencies.sh 1> /dev/null ; fi
  - if [ "$BUILD_HASKELL" != "no" ] ; then export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/1.20/bin:$PATH ; fi
  - if [ "$BUILD_HASKELL" != "no" ] ; then cabal update ; fi
  # Disabling any cabal concurrent jobs to workaround GHC crashes due to out of memory.
  # We can safely remove this to speed up cabal install, once Travis infrastructure is upgraded.
  - if [ "$BUILD_HASKELL" != "no" ] ; then sed -i 's/^\s*jobs\s*:\s*\$ncpus\s*$/jobs:1/g' $HOME/.cabal/config && cat $HOME/.cabal/config | grep jobs ; fi

before_script:
  - sudo /etc/init.d/mysql stop
  - sudo /etc/init.d/postgresql stop

script:
  - if [ "x$CMAKE_CONFIG" != "xnone" ] ; then mkdir cmake_build && cd cmake_build && cmake -GNinja -DQT_MOC_EXECUTABLE="moq-qt5" $CMAKE_CONFIG $TRAVIS_BUILD_DIR ; fi
  - if [ "x$CMAKE_CONFIG" != "xnone" ] ; then ninja -j $CONCURRENT_JOBS ; fi
  - if [ "x$CMAKE_CONFIG" != "xnone" ] ; then cpack ; fi
  - if [ "x$CMAKE_CONFIG" != "xnone" ] ; then ctest -VV -E "(concurrency_test|processor_test|Haskell)" ; fi
  - if [ "x$CONFIG" != "xnone" ] ; then sh bootstrap.sh ; fi
  - if [ "x$CONFIG" != "xnone" ] ; then sh configure $CONFIG ; fi
  - if [ "x$CONFIG" != "xnone" ] ; then make $MAKE_TARGET -j $CONCURRENT_JOBS ; fi

after_failure:
  - if [ "x$ERROR_LOG" != "xnone" ] ; then cat $ERROR_LOG ; fi

env:
  global:
    - TEST_NAME=""
    - CMAKE_CONFIG="none"
    - CONFIG="none"
    - MAKE_TARGET="check"
    - ALL_DEPS="no"
    # Invoke cabal only when necessary because it is flaky due to network and package updates.
    - BUILD_HASKELL="no"
    - GHCVER=7.8.3
    - ERROR_LOG="none"
    - CONCURRENT_JOBS=2

  matrix:
    # Put it here because it's most time consuming
    - TEST_NAME="make cross (automake)"
      THRIFT_CROSSTEST_CONCURRENCY=6
      CONFIG="--enable-tutorial=no --without-lua --without-haxe --without-d"
      ALL_DEPS="yes"
      BUILD_HASKELL="yes"
      MAKE_TARGET="cross"
      ERROR_LOG="test/log/unexpected_failures.log"

    # CMake builds
    - TEST_NAME="compiler (CMake + CPack)"
      CMAKE_CONFIG="-DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF"
    - TEST_NAME="all (CMake + CPack)"
      CMAKE_CONFIG=""
      ALL_DEPS="yes"
      BUILD_HASKELL="yes"
    - TEST_NAME="C++/boost-threads (CMake + CPack)"
      CMAKE_CONFIG="-DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF -DWITH_BOOSTTHREADS=ON"
    - TEST_NAME="C++/std-threads (CMake + CPack)"
      CMAKE_CONFIG="-DCMAKE_CXX_FLAGS=-std=c++0x -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF -DWITH_STDTHREADS=ON"
    - TEST_NAME="compiler (mingw32-gcc, CMake + CPack)"
      CMAKE_CONFIG="-DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake -DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF"

    # Autotool builds
    # TODO: Remove them as migration is made
    - TEST_NAME="compiler (automake)"
      CONFIG="--disable-libs"

    - TEST_NAME="C C# D Dart Erlang Go Haxe (automake)"
      CONFIG="--without-cpp --without-haskell --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby"
      ALL_DEPS="yes"

    - TEST_NAME="Java Lua Node.js Perl PHP Python Ruby (automake)"
      CONFIG="--without-cpp --without-haskell --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe"
      ALL_DEPS="yes"

    # Isolate unstable builds from others
    - TEST_NAME="C++ (automake)"
      CONFIG="--without-haskell --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby"

    - TEST_NAME="Haskell (automake)"
      CONFIG="--without-cpp --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby"
      ALL_DEPS="yes"
      BUILD_HASKELL="yes"

    - TEST_NAME="dist (automake)"
      CONFIG=""
      ALL_DEPS="yes"
      BUILD_HASKELL="yes"
      MAKE_TARGET="dist"


matrix:
  allow_failures:
    # gcc fails on travis seemingly due to out of memory
    - compiler: gcc

  exclude:
    # This one takes very long
    - compiler: gcc
      env: TEST_NAME="make cross (automake)" CONFIG="--without-python" ALL_DEPS="yes" MAKE_TARGET="cross"

    # Does not use native compiler, no need to do it twice
    - compiler: gcc
      env: TEST_NAME="compiler (mingw32-gcc, CMake + CPack)" CMAKE_CONFIG="-DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake -DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF"
    - compiler: gcc
      env: TEST_NAME="dist (automake)" CONFIG="" ALL_DEPS="yes" MAKE_TARGET="dist"

  include:
    - env:
        - TEST_NAME="Debian Packages"
      compiler: clang
      before_install:
       - sh build/travis/installCXXDependencies.sh;
       - sh build/travis/installDependencies.sh 1> /dev/null;
       - sudo apt-get install build-essential mono-gmcs mono-devel libmono-system-web2.0-cil erlang-base ruby1.8-dev python-all python-all-dev python-all-dbg php5 php5-dev
      script:
       - dpkg-buildpackage -tc -us -uc
       - ls -al ..


    # QA jobs for code analytics and metrics

    # static code analysis with cppcheck
    # add --error-exitcode=1 to --enable=all as soon as everything is fixed
    - env:    TEST_NAME="cppcheck"
      before_install: sudo apt-get install cppcheck
      script:
        # Compiler cppcheck (All)
        - cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src
        # C++ cppcheck (All)
        - cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
        # C Glib cppcheck (All)
        - cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
        # Silent error checks
        - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
        - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
        - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib

    # TODO use findbugs for Java
    # TODO use fxcop for C#

    # TODO do style checks

    # search for TODO etc within source tree
    # some statistics about the code base
    # some info about the build machine
    - env:    TEST_NAME="TODO FIXME HACK, LoC and system info"
      before_install: sudo apt-get install sloccount
      script:
        - grep -r TODO *
        - grep -r FIXME *
        - grep -r HACK *
        # LoC
        - sloccount .
        # System Info
        - dpkg -l
        - uname -a

# TODO make it perfect ;-r
#