forked from trombik/esp-homie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
194 lines (179 loc) · 5.89 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
sudo: false
language: bash
# when you suspects issues in cache, use the following line to disable cache.
# cache: false
cache:
directories:
- ${HOME}/distfiles
- ${HOME}/.ccache
- ${HOME}/.cache/pip
os:
- linux
matrix:
include:
# in version esp-idf 4.x, both idf.py and make are officially supported
# build method by espressif.
#
# in version 3.x, make is the supported build method.
#
# in the latest ESP8266 RTOS SDK (3.2), idf.py is included but not
# officially supported by espressif.
- env:
- PROJECT_TARGET="esp32"
- PROJECT_SDK_BRANCH="master"
- PROJECT_BUILD_METHOD="make"
- env:
- PROJECT_TARGET="esp32"
- PROJECT_SDK_BRANCH="master"
- PROJECT_BUILD_METHOD="idf"
- env:
- PROJECT_TARGET="esp32"
- PROJECT_SDK_BRANCH="v3.2.2"
- PROJECT_BUILD_METHOD="make"
- env:
- PROJECT_TARGET="esp32"
- PROJECT_SDK_BRANCH="v3.2"
- PROJECT_BUILD_METHOD="make"
- env:
- PROJECT_TARGET="esp32"
- PROJECT_SDK_BRANCH="v3.3"
- PROJECT_BUILD_METHOD="make"
- env:
- PROJECT_TARGET="esp8266"
- PROJECT_SDK_BRANCH="master"
- PROJECT_BUILD_METHOD="make"
addons:
apt:
packages:
- gcc
- wget
- make
- libncurses-dev
- flex
- bison
- python
- python-pip
- gperf
- ccache
before_install:
# Save path to the git respository
- PROJECT_PATH=$(pwd)
install:
- export TOOLCHAIN_DIR="${HOME}/${PROJECT_TARGET}"
# PROJECT_TOOLCHAIN_FILE, and its URLs, can be found at `tools/tools.json`
# in `esp-idf`.
- |
case ${PROJECT_TARGET} in
esp8266)
export PROJECT_GCC_PREFIX="xtensa-lx106-elf"
export PROJECT_TOOLCHAIN_FILE="xtensa-lx106-elf-linux64-1.22.0-92-g8facf4c-5.2.0.tar.gz"
export PROJECT_SDK_NAME="ESP8266_RTOS_SDK"
# XXX ESP8266 RTOS SDK does not support
# "sdkconfig.defaults.TARGET_NAME" yet.
export SDKCONFIG_DEFAULTS="sdkconfig.defaults.esp8266"
;;
esp32)
export PROJECT_GCC_PREFIX="xtensa-esp32-elf"
export PROJECT_SDK_NAME="esp-idf"
case ${PROJECT_SDK_BRANCH} in
v3.*)
export PROJECT_TOOLCHAIN_FILE="xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz"
# XXX esp-idf 3.x does not support
# "sdkconfig.defaults.TARGET_NAME" yet.
export SDKCONFIG_DEFAULTS="sdkconfig.defaults.esp32_v3"
;;
master)
export PROJECT_TOOLCHAIN_FILE="xtensa-esp32-elf-gcc8_2_0-esp-2019r2-linux-amd64.tar.gz"
;;
*)
echo "Unknown PROJECT_SDK_BRANCH: ${PROJECT_SDK_BRANCH}"
exit 1
;;
esac
;;
*)
echo "Unknown PROJECT_TARGET: ${PROJECT_TARGET}"
exit 1
;;
esac
- export PROJECT_GCC_FILE="${PROJECT_GCC_PREFIX}-gcc"
- export PROJECT_DISTFILE_DIR="${HOME}/distfiles"
- export IDF_PATH=${TOOLCHAIN_DIR}/${PROJECT_SDK_NAME}
- export PROJECT_LOG="${HOME}/build.log"
- export PROJECT_EXAMPLE_DIR="${PROJECT_PATH}/examples"
- |
case ${PROJECT_BUILD_METHOD} in
idf)
export PROJECT_BUILD_COMMAND="python ${IDF_PATH}/tools/idf.py"
export PROJECT_BUILD_COMMAND_ARG="build"
;;
make)
export PROJECT_BUILD_COMMAND="make"
export PROJECT_BUILD_COMMAND_ARG="-j2 DEBUG=1"
;;
*)
echo "Unknown PROJECT_BUILD_METHOD: ${PROJECT_BUILD_METHOD}"
exit 1
;;
esac
- echo ${PROJECT_CONFIG_IDF_TARGET_ESP32}
# Install ESP32 toochain following steps as desribed
# in http://esp-idf.readthedocs.io/en/latest/linux-setup.html
# Prepare directory for the toolchain
- mkdir -p ${TOOLCHAIN_DIR} ${PROJECT_DISTFILE_DIR}
# Get SDK from github
- git clone --branch ${PROJECT_SDK_BRANCH} --recursive https://github.com/espressif/${PROJECT_SDK_NAME}.git ${IDF_PATH}
# Setup ccache to build faster
# XXX when the entire build process exceeds 50 min, th job will be killed
# https://docs.travis-ci.com/user/customizing-the-build/#build-timeouts
- ccache --version
- mkdir ${HOME}/ccache_bin
- (cd ${HOME}/ccache_bin && ln -s /usr/bin/ccache ${PROJECT_GCC_FILE})
- export CCACHE_BASEDIR=$PROJECT_PATH
- export CCACHE_CPP2=true
# Get Python requirements
- python -m pip install --user --upgrade pyOpenSSL
- python -m pip install --user -r ${IDF_PATH}/requirements.txt
# Download binary toolchain if it does not exist
- |
if [ ! -f ${PROJECT_DISTFILE_DIR}/${PROJECT_TOOLCHAIN_FILE} ]; then
wget -O ${PROJECT_DISTFILE_DIR}/${PROJECT_TOOLCHAIN_FILE} https://dl.espressif.com/dl/${PROJECT_TOOLCHAIN_FILE}
fi
- tar -xz -C ${TOOLCHAIN_DIR} -f ${PROJECT_DISTFILE_DIR}/${PROJECT_TOOLCHAIN_FILE}
# Make toolchains available for all terminal sessions
- export PATH=$HOME/ccache_bin:$PATH:$HOME/${PROJECT_TARGET}/${PROJECT_GCC_PREFIX}/bin
script:
- rm -f ${PROJECT_LOG}
# show what is actually executed because travis does not show expanded
# variables in logs.
- echo "build command ${PROJECT_BUILD_COMMAND} ${PROJECT_BUILD_COMMAND_ARG}"
# XXX surpress log output where possible. when the size exceeds 4 MB, the
# job will be killed.
- |
IGNORE_FILE="travis-ignore"
case ${PROJECT_TARGET} in
esp32)
;;
esp8266)
IGNORE_FILE="travis-ignore-esp8266"
;;
esac
cd ${PROJECT_EXAMPLE_DIR}
for i in $(ls -d */); do
if [ ! -e ${PROJECT_EXAMPLE_DIR}/${i}/${IGNORE_FILE} ]; then
echo "Building ${i}..."
cd ${PROJECT_EXAMPLE_DIR}/${i}
# idf.py does not have defconfig
make defconfig || exit 1
${PROJECT_BUILD_COMMAND} ${PROJECT_BUILD_COMMAND_ARG} >> ${PROJECT_LOG}
if [ $? -ne 0 ]; then
# when failed, show last 100 lines for debugging, and exit with
# non-zero exit code
tail -n 100 ${PROJECT_LOG}
exit 1
fi
make clean >/dev/null
# make sure the directory is clean
rm -rf ${i}/sdkconfig ${i}/build
fi
done