Always send paths with '/' as file separator
[qBittorrent.git] / .travis.yml
blobb9fe9b95683a42dba148f927f98d09711fe8b733
1 language: cpp
3 os:
4   - linux
5   - osx
7 dist: xenial
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     - libt_branch=RC_1_1 gui=true build_system=qmake
16     - libt_branch=RC_1_1 gui=false build_system=qmake
17     - libt_branch=RC_1_1 gui=true build_system=cmake
18     - libt_branch=RC_1_1 gui=false build_system=cmake
19   global:
20     - secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
21     - coverity_branch: coverity_scan
23 matrix:
24   allow_failures:
25     - env: libt_branch=RC_1_2 gui=true build_system=cmake
26     - env: libt_branch=RC_1_2 gui=false build_system=cmake
27     - env: libt_branch=RC_1_1 gui=true build_system=cmake
28     - env: libt_branch=RC_1_1 gui=false build_system=cmake
30 branches:
31   except:
32     - search_encoding_windows
33     - v2_9_x
35 notifications:
36   email:
37     on_success: change
38     on_failure: change
40 cache:
41   ccache: true
42   directories:
43     - $HOME/travis/deb
44     - $HOME/travis/brew
46 addons:
47   coverity_scan:
48     project:
49       name: "qbittorrent/qBittorrent"
50       description: "Build submitted via Travis CI"
51     build_command_prepend: "./bootstrap.sh && ./configure $qmake_conf"
52     build_command: "make -j2"
53     branch_pattern: $coverity_branch
54     notification_email: sledgehammer999@qbittorrent.org
55   apt:
56     sources:
57       # sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
58       - sourceline: 'ppa:qbittorrent-team/qbittorrent-stable'
59       - sourceline: 'ppa:beineri/opt-qt59-xenial'
60     packages:
61       # packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
62       - [autoconf, automake, colormake]
63       - [libboost-dev, libboost-system-dev]
64       - libssl-dev
65       - libtorrent-rasterbar-dev
66       - [qt59base, qt59svg, qt59tools]
67       - zlib1g-dev
68       # required for Qt 5.9 from 'beineri' PPA
69       - libgl1-mesa-dev
71 before_install:
72   # only allow specific build for coverity scan, others will stop
73   - 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
75   - shopt -s expand_aliases
76   - alias make="colormake -j2" # Using nprocs/2 sometimes may fail (gcc is killed by system)
77   - qbt_path="$HOME/qbt_install"
78   - qmake_conf="$qmake_conf --prefix=$qbt_path"
79   - cmake_conf="$cmake_conf -DCMAKE_INSTALL_PREFIX=$qbt_path"
81   # options for specific branches
82   - |
83     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
84       # setup virtual display for after_success target
85       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 ;
87       # Qt 5.9
88       PATH=/opt/qt59/bin:${PATH}
89       qmake_conf="$qmake_conf PKG_CONFIG_PATH=/opt/qt59/lib/pkgconfig:$PKG_CONFIG_PATH"
90       cmake_conf="$cmake_conf PKG_CONFIG_PATH=/opt/qt59/lib/pkgconfig:$PKG_CONFIG_PATH"
91     fi
92   - |
93     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
94       CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"
96       openssl_root_path="/usr/local/opt/openssl"
97       qmake_conf="$qmake_conf PKG_CONFIG_PATH=$openssl_root_path/lib/pkgconfig:$PKG_CONFIG_PATH"
98       cmake_conf="$cmake_conf -DOPENSSL_ROOT_DIR=$openssl_root_path"
99     fi
100   - |
101     if [ "$gui" = "false" ]; then
102       qmake_conf="$qmake_conf --disable-gui"
103       cmake_conf="$cmake_conf -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=ON"
104     fi
106   # print settings
107   - echo $libt_branch
108   - echo $gui
109   - echo $build_system
110   - echo $qmake_conf
111   - echo $cmake_conf
113 install:
114   - |
115     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
116       # dependencies
117       PATH="/usr/local/opt/ccache/libexec:$PATH"
119       brew update > /dev/null
120       brew install ccache colormake boost openssl qt zlib
121       brew link --force qt zlib
123       if [ "$build_system" = "cmake" ]; then
124         sudo ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
125         sudo ln -s /usr/local/opt/qt/plugins /usr/local/plugins
126       fi
127     fi
128   - |
129     if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
130       export use_ccache=true
131       ccache -M 512M
132       ccache -V && ccache --show-stats && ccache --zero-stats
133     fi
134   - |
135     if [ "$libt_branch" = "RC_1_2" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
136       wget https://builds.shiki.hu/travis/deb/version
137       if ! cmp --quiet "version" "$HOME/travis/deb/version" ; then
138         echo "Cached files are different from server. Downloading new ones."
139         # First delete old files
140         rm -r "$HOME/travis/deb"
141         mkdir "$HOME/travis/deb"
142         cp "version" $HOME/travis/deb
143         cd "$HOME/travis/deb"
144         wget https://builds.shiki.hu/travis/deb/libtorrent-rasterbar-dev_1.2.x_amd64.deb
145         wget https://builds.shiki.hu/travis/deb/libtorrent-rasterbar10_1.2.x_amd64.deb
146       fi
148       sudo dpkg -i "$HOME/travis/deb/libtorrent-rasterbar-dev_1.2.x_amd64.deb" "$HOME/travis/deb/libtorrent-rasterbar10_1.2.x_amd64.deb"
149     fi
150   - |
151     if [ "$libt_branch" = "RC_1_1" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
152       wget https://builds.shiki.hu/travis/brew/1_1/version
153       if ! cmp --quiet "version" "$HOME/travis/brew/1_1/version" ; then
154         echo "Cached files are different from server. Downloading new ones."
155         # First delete old files
156         rm -r "$HOME/travis/brew/1_1"
157         mkdir "$HOME/travis/brew/1_1"
158         cp "version" $HOME/travis/brew/1_1
159         cd "$HOME/travis/brew/1_1"
160         wget https://builds.shiki.hu/travis/brew/1_1/libtorrent-rasterbar.rb
161         wget https://builds.shiki.hu/travis/brew/1_1/bd36a4b440aa138a88e375c1a3b672f1a1bc6606e7866fc3415b6b98fa49e771--libtorrent-rasterbar-1.1.13.high_sierra.bottle.tar.gz
162       fi
163       # Copy custom libtorrent bottle to homebrew's download cache so it can find and install it
164       # Also install our custom libtorrent formula by passing the local path to it
165       # These 2 files are restored from Travis' cache.
166       cp "$HOME/travis/brew/1_1/bd36a4b440aa138a88e375c1a3b672f1a1bc6606e7866fc3415b6b98fa49e771--libtorrent-rasterbar-1.1.13.high_sierra.bottle.tar.gz" "$(brew --cache)/downloads"
167       brew uninstall libtorrent-rasterbar
168       brew install "$HOME/travis/brew/1_1/libtorrent-rasterbar.rb"
170       # NOTE about the bottle name
171       # The part before the "--" characters is a sha256 hash of the string
172       # of the URL homebrew itself would use to download the bottle.
173       # In this case the URL is the following:
174       # http://127.0.0.1/libtorrent-rasterbar-1.1.13.high_sierra.bottle.tar.gz
175     fi
176   - |
177     if [ "$libt_branch" = "RC_1_2" ] && [ "$TRAVIS_OS_NAME" = "osx" ]; then
178       wget https://builds.shiki.hu/travis/brew/version
179       if ! cmp --quiet "version" "$HOME/travis/brew/version" ; then
180         echo "Cached files are different from server. Downloading new ones."
181         # First delete old files
182         rm -r "$HOME/travis/brew"
183         mkdir "$HOME/travis/brew"
184         cp "version" $HOME/travis/brew
185         cd "$HOME/travis/brew"
186         wget https://builds.shiki.hu/travis/brew/libtorrent-rasterbar.rb
187         wget https://builds.shiki.hu/travis/brew/6e4eb13f70df35e8fc7ff41883fef3e5c7b535dd55c78cd2ce1eae3fb4288e21--libtorrent-rasterbar-1.2.0.high_sierra.bottle.tar.gz
188       fi
189       # Copy custom libtorrent bottle to homebrew's download cache so it can find and install it
190       # Also install our custom libtorrent formula by passing the local path to it
191       # These 2 files are restored from Travis' cache.
192       cp "$HOME/travis/brew/6e4eb13f70df35e8fc7ff41883fef3e5c7b535dd55c78cd2ce1eae3fb4288e21--libtorrent-rasterbar-1.2.0.high_sierra.bottle.tar.gz" "$(brew --cache)/downloads"
193       brew uninstall libtorrent-rasterbar
194       brew install "$HOME/travis/brew/libtorrent-rasterbar.rb"
196       # NOTE about the bottle name
197       # The part before the "--" characters is a sha256 hash of the string
198       # of the URL homebrew itself would use to download the bottle.
199       # In this case the URL is the following:
200       # http://127.0.0.1/libtorrent-rasterbar-1.2.0.high_sierra.bottle.tar.gz
201     fi
203 script:
204   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
205   - |
206     cd "$TRAVIS_BUILD_DIR"
207     if [ "$build_system" = "qmake" ]; then
208       ./bootstrap.sh
209       ./configure $qmake_conf CXXFLAGS="$CXXFLAGS"
210     else
211       mkdir build && cd build
212       cmake $cmake_conf ../
213     fi
214   - make && make install
216 after_success:
217   - if [ "$gui" = "true" ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
218   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
219   - |
220     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
221       if [ "$build_system" = "qmake" ]; then
222         macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
223         cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
224       else
225         cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
226       fi
227     fi
228   - ./$qbt_exe --version
230 after_script:
231   - if [ "$use_ccache" = true ]; then ccache --show-stats ; fi