wip: Test Travis CI for Windows
[quassel.git] / .travis.yml
index 42fae1f..ef8102e 100644 (file)
@@ -1,73 +1,81 @@
-os:
-  - linux
-
 sudo: required
-dist: trusty
-
-language: cpp
-cache: ccache
-
-compiler:
-  - gcc
-  - clang
 
-env:
-  - QT_VERSION=qt4
-  - QT_VERSION=qt5
+services:
+  - docker
 
-matrix:
+# Define a separate job for Windows
+jobs:
   include:
     - os: osx
-      compiler: gcc
-      env: QT_VERSION=qt5
-  exclude:
-    - compiler: clang
-      env: QT_VERSION=qt4
-
-install: |-
-  if [ "$TRAVIS_OS_NAME" == "linux" ]
-  then
-    sudo apt-get -qy install libqt5webkit5-dev qttools5-dev qtscript5-dev
-    sudo apt-get -qy install libdbusmenu-qt-dev libdbusmenu-qt5-dev
-    sudo apt-get -qy install libphonon-dev libphonon4qt5-dev
-    sudo apt-get -qy install libqca2-dev
-    sudo apt-get -qy install qt4-dev-tools qttools5-dev-tools
-    sudo apt-get -qy install libphonon4qt5experimental4 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=805096
-  elif [ "$TRAVIS_OS_NAME" == "osx" ]
-  then
-    brew update
-    brew install ninja qt5
-  fi
-
-script: |-
-  mkdir build
-  cd build
-  if [ "$TRAVIS_OS_NAME" == "linux" ]
-  then
-    if [ "$QT_VERSION" = "qt4" ]; then cmake -DUSE_QT4=ON ..; fi
-    if [ "$QT_VERSION" = "qt5" ]; then cmake ..; fi
-    make
-  elif [ "$TRAVIS_OS_NAME" == "osx" ]
-  then
-    PATH=$PATH:/usr/local/opt/qt5/bin
-    if [[ "$TRAVIS_TAG" != "" && "$GH_TOKEN" != "" ]]
-    then
-      cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DDEPLOY=ON
-    else
-      cmake -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release
-    fi
-    ninja install
-  fi
-
-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: "$TRAVIS_OS_NAME == 'osx' && $GH_TOKEN != ''"
+      language: cpp
+      compiler: clang
+      env:
+      cache:
+        directories:
+          - $HOME/.ccache
+          - $HOME/Library/Caches/Homebrew
+      before_install:
+        - brew update && brew install ccache ninja qca qt5
+      script:
+        - export CCACHE_MAXSIZE=1G
+        - 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 -DBUILD_TESTING=ON -DDEPLOY=$DEPLOY
+          ninja install
+        - ccache -s
+        - ctest
+      deploy:
+        provider: releases
+        api_key: $GH_TOKEN
+        file_glob: true
+        file: *.dmg
+        skip_cleanup: true
+        on:
+          tags: true
+          condition: $GH_TOKEN != ''
+    - os: windows
+      language: bash
+      before_install:
+        - export TARGET=windows-msvc2017_64-cl
+        #- export GITHUB_TOKEN=$GH_TOKEN
+        - |
+          function python {
+              /C/python38/python.exe "$@"
+          }
+        - |
+          function craft {
+              python /C/CraftMaster/$TARGET/craft/bin/craft.py "$@"
+          }
+        - choco install python2
+        - choco install python3
+      install:
+        - git clone --depth=1 https://invent.kde.org/kde/craftmaster.git /C/CraftMaster/CraftMaster
+        - python /C/CraftMaster/CraftMaster/CraftMaster.py --config $TRAVIS_BUILD_DIR/.craft.ini --variables "BUILD_DIR=$TRAVIS_BUILD_DIR"
+        - craft --add-blueprint-repository https://github.com/quassel/craft-blueprints-quassel.git
+        - craft -p quassel/quassel
+        - craft nsis
+        - craft --install-deps quassel/quassel
+      script:
+        - craft --no-cache --src-dir $TRAVIS_BUILD_DIR quassel/quassel
+        - craft --no-cache --src-dir $TRAVIS_BUILD_DIR --test quassel/quassel
+      after_success:
+        - craft --no-cache --src-dir $TRAVIS_BUILD_DIR --package quassel/quassel
+        - ls $TRAVIS_BUILD_DIR/*
+        - ls $TRAVIS_BUILD_DIR/binaries/*
+      deploy:
+        provider: releases
+        api_key: $GH_TOKEN
+        file_glob: true
+        file: $TRAVIS_BUILD_DIR/binaries/*
+        skip_cleanup: true
+        on:
+          tags: true
+          condition: $GH_TOKEN != ''
+      #cache:
+      #  directories:
+      #    - $HOME/AppData/Local/Temp/chocolatey