modernize: Use std::make_unique
[quassel.git] / .travis.yml
index b99c62b..316377f 100644 (file)
@@ -1,15 +1,82 @@
-language: cpp
-compiler:
-  - gcc
-  - clang
+sudo: required
 
+services:
+  - docker
+
+# Define build matrix for Linux
+os: linux
+language: generic  # No host compilation
+
+env:
+  - DIST=xenial CXX=g++     CMAKE_OPTIONS="-DWITH_KDE=OFF -DWITH_WEBKIT=ON"
+  - DIST=xenial CXX=g++     CMAKE_OPTIONS="-DWITH_KDE=ON  -DWITH_WEBKIT=ON"
+  - DIST=xenial CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=OFF -DWITH_WEBKIT=ON"
+  - DIST=xenial CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=ON  -DWITH_WEBKIT=ON"
+  - DIST=bionic CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=OFF -DWITH_WEBENGINE=ON"
+  - DIST=bionic CXX=clang++ CMAKE_OPTIONS="-DWITH_KDE=ON  -DWITH_WEBENGINE=ON"
+
+# Set up cache
+cache:
+  directories:
+    - $TRAVIS_BUILD_DIR/ccache
+
+# Prepare
 before_install:
- - sudo add-apt-repository ppa:kalakris/cmake/test -y
- - sudo apt-get update -qq
- - sudo apt-get install cmake
- - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- - sudo apt-get update -qq
- - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.7; fi
- - if [ "$CXX" = "g++" ]; then export CXX="g++-4.7" CC="gcc-4.7"; fi
-
-script: mkdir build && cd build && cmake ../ && make
+  - docker pull quassel/quassel-build-env:$DIST
+  - docker images
+  - mkdir build
+
+# Build inside the docker image
+# Source, build and ccache directories are bind-mounted into the container
+script:
+  - |
+    docker run -t -w /build --rm \
+               -v "$(readlink -f .):/src" \
+               -v "$(readlink -f build):/build" \
+               -v "$(readlink -f ccache):/ccache" \
+               -e CCACHE_DIR=/ccache \
+               -e CXX=$CXX \
+               quassel/quassel-build-env:$DIST \
+               sh -c "cmake /src $CMAKE_OPTIONS \
+                            -GNinja \
+                            -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+                      && ninja install \
+                      && ccache -s \
+                     "
+
+# Define a separate job for OSX
+jobs:
+  include:
+    - os: osx
+      language: cpp
+      compiler: clang
+      env:
+      cache:
+        directories:
+          - $HOME/.ccache
+          - $HOME/Library/Caches/Homebrew
+      before_install:
+        - brew update && brew install ccache ninja qca qt5
+      script:
+        - mkdir build && cd build
+        - |
+          PATH=$PATH:/usr/local/opt/qt5/bin
+          DEPLOY=OFF
+          if [[ "$TRAVIS_TAG" != "" && "$GH_TOKEN" != "" ]]; then
+            DEPLOY=ON
+          fi
+          cmake -GNinja .. -DCMAKE_BUILD_TYPE=Release -DDEPLOY=$DEPLOY
+          ninja install
+        - ccache -s
+      deploy:
+        provider: releases
+        api_key: "${GH_TOKEN}"
+        file_glob: true
+        file:
+          - "QuasselClient_MacOSX-x86_64_*.dmg"
+          - "QuasselCore_MacOSX-x86_64_*.dmg"
+          - "QuasselMono_MacOSX-x86_64_*.dmg"
+        skip_cleanup: true
+        on:
+          tags: true
+          condition: "$GH_TOKEN != ''"