From 8727cded80bfa43f504c3731e10b3b44dabbafdf Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Sun, 17 Jun 2018 19:52:12 +0200 Subject: [PATCH] travis: Use docker-based builds, new baseline Perform Linux builds in docker images, which allows us to freely define the build environment rather than relying on the Travis host system. Use Ubuntu 16.04 "Xenial" as the new baseline for Quassel, allowing us to make use of a more modern toolchain. Reorganize and modernize travis.yml in general. --- .travis.yml | 132 ++++++++++++++++++++++++++------------------------- appveyor.ini | 31 ------------ appveyor.yml | 38 --------------- 3 files changed, 68 insertions(+), 133 deletions(-) delete mode 100644 appveyor.ini delete mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml index 42fae1f5..cf220371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,73 +1,77 @@ -os: - - linux - sudo: required -dist: trusty -language: cpp -cache: ccache +services: + - docker -compiler: - - gcc - - clang +# Define build matrix for Linux +os: linux +language: generic # No host compilation env: - - QT_VERSION=qt4 - - QT_VERSION=qt5 + - DIST=xenial CXX=gcc + - DIST=xenial CXX=clang -matrix: - include: - - os: osx - compiler: gcc - env: QT_VERSION=qt5 - exclude: - - compiler: clang - env: QT_VERSION=qt4 +# Set up cache +cache: + directories: + - $TRAVIS_BUILD_DIR/ccache -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 +# Prepare +before_install: + - docker pull quassel/quassel-build-env:$DIST + - docker images + - mkdir build -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 +# 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 CC=$CXX -e CXX=$CXX \ + quassel/quassel-build-env:$DIST \ + sh -c 'cmake -GNinja /src \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + && ninja \ + && 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: "$TRAVIS_OS_NAME == 'osx' && $GH_TOKEN != ''" +# Define a separate job for OSX +jobs: + include: + - os: osx + language: cpp + compiler: clang + env: + cache: + ccache: true + directories: + - $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 -G"Ninja" .. -DCMAKE_BUILD_TYPE=Release -DUSE_CCACHE=OFF -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 != ''" diff --git a/appveyor.ini b/appveyor.ini deleted file mode 100644 index 8189a038..00000000 --- a/appveyor.ini +++ /dev/null @@ -1,31 +0,0 @@ -[General] -Command = craft -Branch = master -ShallowClone = True - -# Variables defined here override the default value -# The variable names are casesensitive -[Variables] -#Root = D:\qt-sdk - -# Settings applicable for all Crafts matrices -# Settings are Category/key=value -# Category is case sensitive -[GeneralSettings] -Paths/Python = C:\Python36 -Paths/Python27 = C:\Python27 -ShortPath/Enabled = False -Compile/BuildType = Release -ContinuousIntegration/Enabled = True -Packager/PackageType = MultiCollectionPackager - -[BlueprintSettings] -qt-apps/quassel.version = master - -binary/mysql.ignored = True - -[windows-msvc2017_32-cl] -General/ABI = windows-msvc2017_32-cl - -[windows-msvc2017_64-cl] -General/ABI = windows-msvc2017_64-cl diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 30d9dc12..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: '{build}' - -image: Visual Studio 2017 - -init: -- ps: | - function craft() { - & C:\python36\python.exe "C:\CraftMaster\$env:TARGET\craft\bin\craft.py" $args - if($LASTEXITCODE -ne 0) {exit $LASTEXITCODE} - } - -install: -- ps: | - mkdir C:\CraftMaster | Out-Null - #use cmd to silence powershell behaviour for stderr - & cmd /C "git clone -q --depth=1 git://anongit.kde.org/craftmaster.git C:\CraftMaster\CraftMaster 2>&1" - & C:\python36\python.exe C:\CraftMaster\CraftMaster\CraftMaster.py --config $env:APPVEYOR_BUILD_FOLDER\appveyor.ini --target $env:TARGET - craft -p quassel - craft nsis - craft --install-deps quassel - -build_script: -- ps: | - craft --no-cache --src-dir $env:APPVEYOR_BUILD_FOLDER quassel - -test_script: -- ps: | - craft --src-dir $env:APPVEYOR_BUILD_FOLDER --test quassel - -on_success: -- ps: | - craft --src-dir $env:APPVEYOR_BUILD_FOLDER --package quassel - Get-ChildItem C:\CraftMaster\$env:TARGET\tmp\* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - -environment: - matrix: - - TARGET: windows-msvc2017_64-cl - - TARGET: windows-msvc2017_32-cl -- 2.20.1