Sync translations from Transifex and run lupdate
[qBittorrent.git] / .travis.yml
blobdbf00b2df032e8277847bd9c4a7ca485df8dbf60
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     packages:
51       # packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty
52       - [autoconf, automake, cmake, colormake]
53       - [libboost-dev, libboost-system-dev]
54       - libssl-dev
55       - [qtbase5-dev, libqt5svg5-dev, qttools5-dev]
56       - zlib1g-dev
58 before_install:
59   # only allow specific build for coverity scan, others will stop
60   - 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
62   - shopt -s expand_aliases
63   - alias make="colormake -j2" # Using nprocs/2 sometimes may fail (gcc is killed by system)
64   - qbt_path="$HOME/qbt_install"
65   - qmake_conf="$qmake_conf --prefix=$qbt_path"
66   - cmake_conf="$cmake_conf -DCMAKE_INSTALL_PREFIX=$qbt_path"
68   # options for specific branches
69   - |
70     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
71       # setup virtual display for after_success target
72       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 ;
73       # CMake from Kitware is installed in /usr/bin
74       # TravisCI installs its own cmake to another location which ovverides other installations
75       # if they don't call the new binary directly
76       alias cmake="/usr/bin/cmake"
78       export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
79     fi
80   - |
81     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
82       CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"
84       openssl_root_path="/usr/local/opt/openssl"
85       qmake_conf="$qmake_conf PKG_CONFIG_PATH=$openssl_root_path/lib/pkgconfig:$PKG_CONFIG_PATH"
86       cmake_conf="$cmake_conf -DOPENSSL_ROOT_DIR=$openssl_root_path"
87     fi
88   - |
89     if [ "$gui" = "false" ]; then
90       qmake_conf="$qmake_conf --disable-gui"
91       cmake_conf="$cmake_conf -DGUI=OFF"
92     fi
94   # print settings
95   - echo $libt_branch
96   - echo $gui
97   - echo $build_system
98   - echo $qmake_conf
99   - echo $cmake_conf
101 install:
102   - |
103     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
104       # dependencies
105       PATH="/usr/local/opt/ccache/libexec:$PATH"
107       brew update > /dev/null
108       brew upgrade cmake
109       brew install ccache colormake boost openssl qt@5 zlib
110       brew link --force qt@5 zlib
112       if [ "$build_system" = "cmake" ]; then
113         sudo ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
114         sudo ln -s /usr/local/opt/qt/plugins /usr/local/plugins
115       fi
116     fi
117   - |
118     if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
119       export use_ccache=true
120       ccache -M 512M
121       ccache -V && ccache --show-stats && ccache --zero-stats
122     fi
123   - |
124     if [ "$libt_branch" = "RC_1_2" ]; then
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.12
130       cmake \
131         -DCMAKE_BUILD_TYPE=Release \
132         -DCMAKE_CXX_STANDARD=17 \
133         -Ddeprecated-functions=OFF \
134         -DOPENSSL_ROOT_DIR="$openssl_root_path" \
135         ./
136       make
137       sudo make install
138       popd
139     elif [ "$libt_branch" = "RC_2_0" ]; then
140       pushd "$HOME"
141       git clone --single-branch --branch RC_2_0 https://github.com/arvidn/libtorrent.git
142       cd libtorrent
143       git checkout tags/v2.0.2
144       git submodule update --init --recursive
146       cmake \
147         -DCMAKE_BUILD_TYPE=Release \
148         -DCMAKE_CXX_STANDARD=17 \
149         -Ddeprecated-functions=OFF \
150         -DOPENSSL_ROOT_DIR="$openssl_root_path" \
151         ./
152       make
153       sudo make install
154       popd
155     fi
157 script:
158   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
159   - |
160     cd "$TRAVIS_BUILD_DIR"
161     if [ "$build_system" = "qmake" ]; then
162       # scan only as lupdate is prone to hang
163       lupdate -extensions c,cpp,h,hpp,ui ./
164       ./bootstrap.sh
165       ./configure $qmake_conf CXXFLAGS="$CXXFLAGS"
166     else
167       mkdir build && cd build
168       cmake $cmake_conf ../
169     fi
170   - make
171   - make install
173 after_success:
174   - if [ "$gui" = "true" ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
175   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
176   - |
177     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
178       if [ "$build_system" = "qmake" ]; then
179         macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
180         cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
181       else
182         cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
183       fi
184     fi
185   - ./$qbt_exe --version
187 after_script:
188   - if [ "$use_ccache" = true ]; then ccache --show-stats ; fi