Preselect name without extension when renaming files
[qBittorrent.git] / .travis.yml
blobced0932c8b29f13efe5427650e4ae75696304b2f
1 language: cpp
3 os:
4   - linux
5   - osx
6 osx_image: xcode7.3
8 env:
9   matrix:
10     # Uncomment when Travis upgraded "Ubuntu 12.04 LTS" to a newer version whose repo will have a more up-to-date libtorrent package
11     #- lt_branch=dist gui=true
12     #- lt_branch=dist gui=false
13     - lt_branch=RC_1_0 gui=true build_system=cmake
14     - lt_branch=RC_1_0 gui=false build_system=cmake
15     - lt_branch=RC_1_0 gui=true build_system=qmake
16     - lt_branch=RC_1_0 gui=false build_system=qmake
17   global:
18     - secure: "OI9CUjj4lTb0HwwIZU5PbECU3hLlAL6KC8KsbwohG8/O3j5fLcnmDsK4Ad9us5cC39sS11Jcd1kDP2qRcCuST/glVNhLkcjKkiQerOfd5nQ/qL4JYfz/1mfP5mdpz9jHKzpLUIG+TXkbSTjP6VVmsb5KPT+3pKEdRFZB+Pu9+J8="
19     - coverity_branch: coverity_scan
21 matrix:
22   allow_failures:
23     - env: lt_branch=RC_1_0 gui=true build_system=cmake
24     - env: lt_branch=RC_1_0 gui=false build_system=cmake
26 branches:
27   except:
28     - search_encoding_windows
29     - v2_9_x
31 notifications:
32   email:
33     on_success: change
34     on_failure: change
36 cache:
37   ccache: true
38   directories:
39     - $HOME/hombebrew_cache
41 # opt-in Ubuntu Trusty
42 dist: trusty
43 # container-based builds
44 sudo: false
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 $qbtconf"
52     build_command: make
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-whitelist/blob/master/ubuntu.json
58       - ubuntu-toolchain-r-test
59       #- boost-latest
60       - sourceline: 'ppa:qbittorrent-team/qbittorrent-stable'
61       - sourceline: 'ppa:beineri/opt-qt551-trusty'
62       - sourceline: 'ppa:adrozdoff/cmake'
63     packages:
64       # packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
65       - [autoconf, automake, colormake]
66       - [cmake, ninja-build]
67       - libssl-dev
68       - [libboost-dev, libboost-system-dev]
69       - libtorrent-rasterbar-dev
70       - [qt55base, qt55svg, qt55tools]
71       - [gcc-6, g++-6]
73 before_install:
74   # only allow specific build for coverity scan, others will stop
75   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ] && ! [ "$TRAVIS_OS_NAME" = "linux" -a "$lt_branch" = "RC_1_0" -a "$gui" = true -a "$build_system" = "qmake" ]; then exit ; fi
77   - shopt -s expand_aliases
78   - alias make="colormake -j3" # Using nprocs/2 sometimes may fail (gcc is killed by system)
79   - qbt_path="$HOME/qbt_install"
80   - |
81     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
82       qbtconf="$qbtconf --prefix="$qbt_path" PKG_CONFIG_PATH=/opt/qt55/lib/pkgconfig:$PKG_CONFIG_PATH"
83     else
84       qbtconf="$qbtconf --prefix="$qbt_path""
85     fi
87   # options for specific branches
88   - if [ "$gui" = false ]; then qbtconf="$qbtconf --disable-gui" ; fi
89   - |
90     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
91       # setup virtual display for after_success target
92       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 ;
94       # Qt 5
95       PATH=/opt/qt55/bin:${PATH}
97       if [ "$build_system" = "cmake" ]; then
98           COMPILER_VERSION=6
99           export CXX="${CXX}-${COMPILER_VERSION}" CC="${CC}-${COMPILER_VERSION}"
100       fi
101     fi
103   # print settings
104   - echo $lt_branch
105   - echo $gui
106   - echo $build_system
107   - echo $ltconf
108   - echo $qbtconf
110 install:
111   #- |
112     #if [ "$TRAVIS_OS_NAME" = "linux" ]; then
113       # build libtorrent from source
114       #if [ "$lt_branch" != "dist" ]; then
115         #cd "$HOME" && pwd && git clone --depth 1 https://github.com/arvidn/libtorrent.git --branch $lt_branch
116         #cd libtorrent && ./autotool.sh && ./configure $ltconf && make install
117       #fi
118     #fi
119   - |
120     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
121       # dependencies
122       brew update > /dev/null
123       brew outdated "pkg-config" || brew upgrade "pkg-config"
124       brew install colormake ccache zlib qt
125       PATH="/usr/local/opt/ccache/libexec:$PATH"
126       brew link --force zlib qt
128       wget https://builds.shiki.hu/homebrew/version
129       if ! cmp --quiet "version" "$HOME/hombebrew_cache/version" ; then
130         echo "Cached files are different from server. Downloading new ones."
131         # First delete old files
132         rm -r "$HOME/hombebrew_cache"
133         mkdir "$HOME/hombebrew_cache"
134         cp "version" $HOME/hombebrew_cache
135         cd "$HOME/hombebrew_cache"
136         wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar.rb
137         wget https://builds.shiki.hu/homebrew/libtorrent-rasterbar-1.1.7+git20180422.3ede0b9c20+patched-configure.el_capitan.bottle.tar.gz
138       fi
140       # Copy custom libtorrent bottle to homebrew's cache so it can find and install it
141       # Also install our custom libtorrent formula by passing the local path to it
142       # These 2 files are restored from Travis' cache.
143       cp "$HOME/hombebrew_cache/libtorrent-rasterbar-1.1.7+git20180422.3ede0b9c20+patched-configure.el_capitan.bottle.tar.gz" "$(brew --cache)"
144       brew install "$HOME/hombebrew_cache/libtorrent-rasterbar.rb"
146       if [ "$build_system" = "cmake" ]; then
147         brew outdated cmake || brew upgrade cmake
148         brew install ninja
150         ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs
151         ln -s /usr/local/opt/qt/plugins /usr/local/plugins
152       fi
154       MY_CMAKE_OPENSSL_HINT="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/"
155     fi
156   - |
157     if [ "$TRAVIS_BRANCH" != "$coverity_branch" ]; then
158       export use_ccache=true
159       ccache -V && ccache --show-stats && ccache --zero-stats
160     fi
162 script:
163   - if [ "$TRAVIS_BRANCH" = "$coverity_branch" ]; then exit ; fi # skip usual build when running coverity scan
164   - |
165     cd "$TRAVIS_BUILD_DIR"
166     if [ "$build_system" = "cmake" ]; then
167       mkdir build
168       cd build
169       if [ "$gui" = "false" ]; then
170         DISABLE_GUI_OPTION="-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=ON"
171       fi
172       cmake $DISABLE_GUI_OPTION -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
173         -G "Ninja" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ..
174       BUILD_TOOL="ninja"
175     fi
176     if [ "$build_system" = "qmake" ]; then
177       if [ "$TRAVIS_OS_NAME" = "osx" ]; then
178         # For some reason for RC_1_1 we need to also specify the OpenSSL compiler/linker flags
179         # Homebrew doesn't symlink OpenSSL for security reasons
180         ./bootstrap.sh && ./configure $qbtconf CXXFLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" pkg-config --cflags openssl)" LDFLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" pkg-config --libs openssl)"
181         sed -i "" -e "s/^\(CC.*&&\).*$/\1 $CC/" src/Makefile  # workaround for Qt & ccache: https://bugreports.qt.io/browse/QTBUG-31034
182         sed -i "" -e "s/^\(CXX.*&&\).*$/\1 $CXX/" src/Makefile
183         sed -i "" -e 's/^\(CXXFLAGS.*\)$/\1 -Wno-unused-local-typedefs -Wno-inconsistent-missing-override/' src/Makefile
184       else
185         ./bootstrap.sh && ./configure $qbtconf
186       fi
187       BUILD_TOOL="make"
188     fi
189   - $BUILD_TOOL && $BUILD_TOOL install
191 after_success:
192   - if [ "$gui" = true ]; then qbt_exe="qbittorrent" ; else qbt_exe="qbittorrent-nox" ; fi
193   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd "$qbt_path/bin" ; fi
194   - |
195     if [ "$TRAVIS_OS_NAME" = "osx" ]; then
196       if [ "$build_system" = "qmake" ]; then
197         macdeployqt "$TRAVIS_BUILD_DIR/src/$qbt_exe.app"
198         cd "$TRAVIS_BUILD_DIR/src/$qbt_exe.app/Contents/MacOS"
199       else
200         cd "$qbt_path/$qbt_exe.app/Contents/MacOS"
201       fi
202     fi
203   - ./$qbt_exe --version
205 after_script:
206   - if [ "$use_ccache" = true ]; then ccache --show-stats ; fi