tests: Enable tests in Travis
[quassel.git] / .travis.yml
1 sudo: required
2
3 services:
4   - docker
5
6 # Define build matrix for Linux
7 os: linux
8 language: generic  # No host compilation
9
10 env:
11   - DIST=xenial CXX=g++     CMAKE_OPTIONS="-DWITH_KDE=OFF -DWITH_WEBKIT=ON"
12   - DIST=xenial CXX=g++     CMAKE_OPTIONS="-DWITH_KDE=ON  -DWITH_WEBKIT=ON"
13   - DIST=xenial CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=OFF -DWITH_WEBKIT=ON"
14   - DIST=xenial CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=ON  -DWITH_WEBKIT=ON"
15   - DIST=bionic CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=OFF -DWITH_WEBENGINE=ON"
16   - DIST=bionic CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=ON  -DWITH_WEBENGINE=ON"
17
18 # Set up cache
19 cache:
20   directories:
21     - $TRAVIS_BUILD_DIR/ccache
22
23 # Prepare
24 before_install:
25   - docker pull quassel/quassel-build-env:$DIST
26   - docker images
27   - mkdir build
28
29 # Build inside the docker image
30 # Source, build and ccache directories are bind-mounted into the container
31 script:
32   - |
33     docker run -t -w /build --rm \
34                -v "$(readlink -f .):/src" \
35                -v "$(readlink -f build):/build" \
36                -v "$(readlink -f ccache):/ccache" \
37                -e CCACHE_DIR=/ccache \
38                -e CXX=$CXX \
39                quassel/quassel-build-env:$DIST \
40                sh -c "cmake /src $CMAKE_OPTIONS \
41                             -GNinja \
42                             -DCMAKE_BUILD_TYPE=RelWithDebInfo \
43                             -DBUILD_TESTING=ON \
44                       && ninja install \
45                       && ccache -s \
46                       && ninja test \
47                      "
48
49 # Define a separate job for OSX
50 jobs:
51   include:
52     - os: osx
53       language: cpp
54       compiler: clang
55       env:
56       cache:
57         directories:
58           - $HOME/.ccache
59           - $HOME/Library/Caches/Homebrew
60       before_install:
61         - brew update && brew install ccache ninja qca qt5
62       script:
63         - mkdir build && cd build
64         - |
65           PATH=$PATH:/usr/local/opt/qt5/bin
66           DEPLOY=OFF
67           if [[ "$TRAVIS_TAG" != "" && "$GH_TOKEN" != "" ]]; then
68             DEPLOY=ON
69           fi
70           cmake -GNinja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DDEPLOY=$DEPLOY
71           ninja install
72         - ccache -s
73         - ninja test
74       deploy:
75         provider: releases
76         api_key: "${GH_TOKEN}"
77         file_glob: true
78         file:
79           - "QuasselClient_MacOSX-x86_64_*.dmg"
80           - "QuasselCore_MacOSX-x86_64_*.dmg"
81           - "QuasselMono_MacOSX-x86_64_*.dmg"
82         skip_cleanup: true
83         on:
84           tags: true
85           condition: "$GH_TOKEN != ''"