Don't try to remove folders for a torrent without metadata
[qBittorrent.git] / .travis.yml
blob1357fb6dd9711edeaff1d20f2d50b23851f98ec9
1 language: cpp
3 os:
4   - linux
5   - osx
7 dist: bionic
9 env:
10   matrix:
11     - libt_branch=RC_1_2 gui=true build_system=qmake
12     - libt_branch=RC_1_2 gui=false build_system=qmake
13     - libt_branch=RC_1_2 gui=true build_system=cmake
14     - libt_branch=RC_1_2 gui=false build_system=cmake
15   global:
16     - secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
17     - coverity_branch: coverity_scan
19 notifications:
20   email:
21     on_success: change
22     on_failure: change
24 cache:
25   ccache: true
26   directories:
27     - $HOME/travis/deb
28     - $HOME/travis/brew
30 addons:
31   coverity_scan:
32     project:
33       name: "qbittorrent/qBittorrent"
34       description: "Build submitted via Travis CI"
35     build_command_prepend: "./bootstrap.sh && ./configure $qmake_conf"
36     build_command: "make -j2"
37     branch_pattern: $coverity_branch
38     notification_email: sledgehammer999@qbittorrent.org
39   apt:
40     sources:
41       # sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
42       - sourceline: 'ppa:qbittorrent-team/qbt-libtorrent-travisci'
43       - sourceline: 'deb https://apt.kitware.com/ubuntu/ bionic main'
44         key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
45     packages:
46       # packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
47       - [autoconf, automake, cmake, colormake]
48       - [libboost-dev, libboost-system-dev]
49       - libssl-dev
50       - [qtbase5-dev, libqt5svg5-dev, qttools5-dev]
51       - zlib1g-dev
53 before_install:
54   # only allow specific build for coverity scan, others will stop
55   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ] && ! [ "$TRAVIS_OS_NAME" = "linux" -a "$libt_branch" = "RC_1_2" -a "$gui" = "true" -a "$build_system" = "qmake" ]; then exit ; fi
57   - shopt -s expand_aliases
58   - alias make="colormake -j2" # Using nprocs/2 sometimes may fail (gcc is killed by system)
59   - qbt_path="$HOME/qbt_install"
60   - qmake_conf="$qmake_conf --prefix=$qbt_path"
61   - cmake_conf="$cmake_conf -DCMAKE_INSTALL_PREFIX=$qbt_path"
63   # options for specific branches
64   - |
65     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
66       # setup virtual display for after_success target
67       if [ "$gui" = "true" ]; then export "DISPLAY=:99.0" && /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 ; fi ;
68       # CMake from Kitware is installed in /usr/bin
69       # TravisCI installs its own cmake to another location which ovverides other installations
70       # if they don't call the new binary directly
71       alias cmake="/usr/bin/cmake"
72     fi
73   - |
74     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
75       CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"
77       openssl_root_path="/usr/local/opt/openssl"
78       qmake_conf="$qmake_conf PKG_CONFIG_PATH=$openssl_root_path/lib/pkgconfig:$PKG_CONFIG_PATH"
79       cmake_conf="$cmake_conf -DOPENSSL_ROOT_DIR=$openssl_root_path"
80     fi
81   - |
82     if [ "$gui" = "false" ]; then
83       qmake_conf="$qmake_conf --disable-gui"
84       cmake_conf="$cmake_conf -DGUI=OFF"
85     fi
87   # print settings
88   - echo $libt_branch
89   - echo $gui
90   - echo $build_system
91   - echo $qmake_conf
92   - echo $cmake_conf
94 install:
95   - |
96     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
97       # dependencies
98       PATH="/usr/local/opt/ccache/libexec:$PATH"
100       brew update > /dev/null
101       brew upgrade cmake
102       brew install ccache colormake boost openssl qt zlib
103       brew link --force qt zlib
105       if [ "$build_system" = "cmake" ]; then
106         sudo ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
107         sudo ln -s /usr/local/opt/qt/plugins /usr/local/plugins
108       fi
109     fi
110   - |
111     if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
112       export use_ccache=true
113       ccache -M 512M
114       ccache -V && ccache --show-stats && ccache --zero-stats
115     fi
116   - |
117     if [ "$libt_branch" = "RC_1_2" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
118       # Will install latest 1.2.x daily build from the PPA
119       sudo apt-get -y install libtorrent-rasterbar-dev
120     fi
121   - |
122     if [ "$libt_branch" = "RC_1_2" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
123       # building libtorrent manually should be faster than using the official bottle
124       # because the bottle will also pull in a lot of updated dependencies and prolong the overall time
125       pushd "$HOME"
126       git clone --single-branch --branch RC_1_2 https://github.com/arvidn/libtorrent.git
127       cd libtorrent
128       git checkout tags/v1.2.10
130       cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -Ddeprecated-functions=OFF -DOPENSSL_ROOT_DIR="$openssl_root_path" ./
131       make
132       sudo make install
133       popd
134     fi
136 script:
137   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
138   - |
139     cd "$TRAVIS_BUILD_DIR"
140     if [ "$build_system" = "qmake" ]; then
141       # scan only as lupdate is prone to hang
142       lupdate -extensions c,cpp,h,hpp,ui ./
143       ./bootstrap.sh
144       ./configure $qmake_conf CXXFLAGS="$CXXFLAGS"
145     else
146       mkdir build && cd build
147       cmake $cmake_conf ../
148     fi
149   - make
150   - make install
152 after_success:
153   - if [ "$gui" = "true" ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
154   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
155   - |
156     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
157       if [ "$build_system" = "qmake" ]; then
158         macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
159         cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
160       else
161         cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
162       fi
163     fi
164   - ./$qbt_exe --version
166 after_script:
167   - if [ "$use_ccache" = true ]; then ccache --show-stats ; fi