-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
138 lines (105 loc) · 3.31 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
language: cpp
env:
global:
- CCACHE_CPP2=1
- JOBS=4
- SHADOW_BUILD_DIR=/tmp/shadow_build_dir
- QT_SHORT_VERSION=5.9
- QT_FULL_VERSION=${QT_SHORT_VERSION}.3
- LINUX_SPEC=linux-g++-64
- OSX_SPEC=macx-clang
- GCC_VERSION=7
- GXX_VERSION=${GCC_VERSION}
- CACHE_DIR=/tmp/qtcache
matrix:
fast_finish: true
include:
# Release jobs
- os: linux
dist: trusty
env: SPEC="${LINUX_SPEC}" CONFIG=release
sudo: required
if: branch = master OR type = pull_request
- os: osx
osx_image: xcode9
env: SPEC="${OSX_SPEC}" CONFIG=release
sudo: required
if: branch = master OR type = pull_request
# Debug jobs
- os: linux
dist: trusty
env: SPEC="${LINUX_SPEC}" CONFIG=debug
sudo: required
if: branch =~ ^wip OR branch =~ ^pr- OR type = pull_request
- os: osx
osx_image: xcode9
env: SPEC="${OSX_SPEC}" CONFIG=debug
sudo: required
if: branch =~ ^wip OR branch =~ ^pr- OR type = pull_request
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- ccache
- libudev-dev
- wget
- libblkid-dev
cache:
directories:
- $HOME/.ccache
- ${CACHE_DIR}
before_install:
# fetch entire git repo to properly determine the version
- if [ "${CONFIG}" = "installer" ]; then
cd ${TRAVIS_BUILD_DIR} && git fetch --unshallow && git fetch --all --tags;
fi
# compile threads
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
export JOBS=$((`cat /proc/cpuinfo | grep -c ^processor`+1));
elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
export JOBS=$((`sysctl -n hw.ncpu`+1));
fi
# clouds urls
- export QT_CLOUD="http://files.emlid.com/qgc/Qt"
# qt names
- export QT_FOLDER_NAME="Qt${QT_FULL_VERSION}-${SPEC}"
- export QT_PACKAGE_NAME="${QT_FOLDER_NAME}.tar.bz2"
- export QT_DIR="/tmp/${QT_FOLDER_NAME}/${SPEC}/"
# general paths
- export QT_QPA_PLATFORM_PLUGIN_PATH="${QT_DIR}/plugins"
- export QML2_IMPORT_PATH="${QT_DIR}/qml"
- export PATH="${QT_DIR}/bin:$PATH"
install:
# Check for Qt cache
- if [ -z "$(ls -A ${CACHE_DIR} 2>&-)" ]; then
echo "Qt cache not found. Downloading from cloud..." &&
mkdir -p "${CACHE_DIR}" && cd "${CACHE_DIR}" &&
wget "${QT_CLOUD}/${QT_PACKAGE_NAME}" &&
cd -
;
fi
- tar -jxf "${CACHE_DIR}/${QT_PACKAGE_NAME}" -C /tmp
# linux exports
- if [ "${SPEC}" = "${LINUX_SPEC}" ]; then
sudo apt-get update &&
sudo apt-get install g++-${GXX_VERSION} gcc-${GCC_VERSION} &&
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GXX_VERSION} 90 &&
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 90 &&
export CXX=g++-${GXX_VERSION} &&
export CC=gcc-${GCC_VERSION} &&
export DISPLAY=:99.0
;
fi
- if [ "${SPEC}" = "${OSX_SPEC}" ]; then
brew update && brew install ccache
;
fi
# print ccache stats
- ccache -s
script:
# run qmake
- mkdir "${SHADOW_BUILD_DIR}" && cd "${SHADOW_BUILD_DIR}"
- qmake -r "${TRAVIS_BUILD_DIR}/devlib.pro" QMAKE_CXX='ccache $${QMAKE_CXX}' CONFIG+="${CONFIG}" -spec "${SPEC}"
# compile
- make -j$JOBS;