Merge pull request #15129 from adem4ik/patch-5
[qBittorrent.git] / .travis.yml
blob878aa2ba10930861722dbce321c3939f1a52eb29
1 language: cpp
3 os:
4   - linux
5   - osx
7 dist: focal
8 osx_image: xcode12.2
10 env:
11   matrix:
12     - libt_branch=RC_1_2 gui=true build_system=qmake
13     - libt_branch=RC_1_2 gui=false build_system=qmake
14     - libt_branch=RC_1_2 gui=true build_system=cmake
15     - libt_branch=RC_1_2 gui=false build_system=cmake
16   global:
17     - secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
18     - coverity_branch: coverity_scan
20 jobs:
21   include:
22   - env: libt_branch=RC_2_0 gui=true build_system=qmake
23     os: linux
25 notifications:
26   email:
27     on_success: change
28     on_failure: change
30 cache:
31   ccache: true
32   directories:
33     - $HOME/travis/deb
34     - $HOME/travis/brew
36 addons:
37   coverity_scan:
38     project:
39       name: "qbittorrent/qBittorrent"
40       description: "Build submitted via Travis CI"
41     build_command_prepend: "./bootstrap.sh && ./configure $qmake_conf"
42     build_command: "make -j2"
43     branch_pattern: $coverity_branch
44     notification_email: sledgehammer999@qbittorrent.org
45   apt:
46     sources:
47       # sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json
48       - sourceline: 'deb https://apt.kitware.com/ubuntu/ focal main'
49         key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
50       - sourceline: 'ppa:beineri/opt-qt-5.14.2-focal'
51     packages:
52       # packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
53       - [autoconf, automake, cmake, colormake]
54       - [libboost-dev, libboost-system-dev]
55       - libssl-dev
56       - [qt514base, qt514svg, qt514tools]
57       - zlib1g-dev
59 before_install:
60   # only allow specific build for coverity scan, others will stop
61   - 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
63   - shopt -s expand_aliases
64   - alias make="colormake -j2" # Using nprocs/2 sometimes may fail (gcc is killed by system)
65   - qbt_path="$HOME/qbt_install"
66   - qmake_conf="$qmake_conf --prefix=$qbt_path"
67   - cmake_conf="$cmake_conf -DCMAKE_INSTALL_PREFIX=$qbt_path"
69   # options for specific branches
70   - |
71     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
72       # setup virtual display for after_success target
73       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 ;
74       # CMake from Kitware is installed in /usr/bin
75       # TravisCI installs its own cmake to another location which ovverides other installations
76       # if they don't call the new binary directly
77       alias cmake="/usr/bin/cmake"
79       # Qt 5.14.2
80       PATH="/opt/qt514/bin:$PATH"
81       qmake_conf="$qmake_conf PKG_CONFIG_PATH=/opt/qt514/lib/pkgconfig:$PKG_CONFIG_PATH"
82       cmake_conf="$cmake_conf PKG_CONFIG_PATH=/opt/qt514/lib/pkgconfig:$PKG_CONFIG_PATH"
84       export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
85     fi
86   - |
87     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
88       CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"
90       openssl_root_path="/usr/local/opt/openssl"
91       qmake_conf="$qmake_conf PKG_CONFIG_PATH=$openssl_root_path/lib/pkgconfig:$PKG_CONFIG_PATH"
92       cmake_conf="$cmake_conf -DOPENSSL_ROOT_DIR=$openssl_root_path"
93     fi
94   - |
95     if [ "$gui" = "false" ]; then
96       qmake_conf="$qmake_conf --disable-gui"
97       cmake_conf="$cmake_conf -DGUI=OFF"
98     fi
100   # print settings
101   - echo $libt_branch
102   - echo $gui
103   - echo $build_system
104   - echo $qmake_conf
105   - echo $cmake_conf
107 install:
108   - |
109     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
110       # dependencies
111       PATH="/usr/local/opt/ccache/libexec:$PATH"
113       brew update > /dev/null
114       brew upgrade cmake
115       brew install ccache colormake boost openssl qt@5 zlib
116       brew link --force qt@5 zlib
118       if [ "$build_system" = "cmake" ]; then
119         sudo ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
120         sudo ln -s /usr/local/opt/qt/plugins /usr/local/plugins
121       fi
122     fi
123   - |
124     if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
125       export use_ccache=true
126       ccache -M 512M
127       ccache -V && ccache --show-stats && ccache --zero-stats
128     fi
129   - |
130     if [ "$libt_branch" = "RC_1_2" ]; then
131       pushd "$HOME"
132       git clone --single-branch --branch RC_1_2 https://github.com/arvidn/libtorrent.git
133       cd libtorrent
134       git checkout tags/v1.2.13
136       cmake \
137         -DCMAKE_BUILD_TYPE=Release \
138         -DCMAKE_CXX_STANDARD=17 \
139         -Ddeprecated-functions=OFF \
140         -DOPENSSL_ROOT_DIR="$openssl_root_path" \
141         ./
142       make
143       sudo make install
144       popd
145     elif [ "$libt_branch" = "RC_2_0" ]; then
146       pushd "$HOME"
147       git clone --single-branch --branch RC_2_0 https://github.com/arvidn/libtorrent.git
148       cd libtorrent
149       git checkout tags/v2.0.3
150       git submodule update --init --recursive
152       cmake \
153         -DCMAKE_BUILD_TYPE=Release \
154         -DCMAKE_CXX_STANDARD=17 \
155         -Ddeprecated-functions=OFF \
156         -DOPENSSL_ROOT_DIR="$openssl_root_path" \
157         ./
158       make
159       sudo make install
160       popd
161     fi
163 script:
164   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
165   - |
166     cd "$TRAVIS_BUILD_DIR"
167     if [ "$build_system" = "qmake" ]; then
168       # scan only as lupdate is prone to hang
169       lupdate -extensions c,cpp,h,hpp,ui ./
170       ./bootstrap.sh
171       ./configure $qmake_conf CXXFLAGS="$CXXFLAGS"
172     else
173       mkdir build && cd build
174       cmake $cmake_conf ../
175     fi
176   - make
177   - make install
179 after_success:
180   - if [ "$gui" = "true" ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
181   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
182   - |
183     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
184       if [ "$build_system" = "qmake" ]; then
185         macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
186         cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
187       else
188         cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
189       fi
190     fi
191   - ./$qbt_exe --version
193 after_script:
194   - if [ "$use_ccache" = true ]; then ccache --show-stats ; fi