forked from LarryN3t/esp-idf-lib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
141 lines (128 loc) · 4.41 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
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:
- 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="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}"
- |
if [ ${PROJECT_TARGET} == "esp8266" ]; then
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"
else
export PROJECT_GCC_PREFIX="xtensa-esp32-elf"
export PROJECT_TOOLCHAIN_FILE=xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-linux-amd64.tar.gz
export PROJECT_SDK_NAME="esp-idf"
fi
- 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"
- |
if [ ${PROJECT_BUILD_METHOD} == "idf" ]; then
export PROJECT_BUILD_COMMAND="python ${IDF_PATH}/tools/idf.py"
export PROJECT_BUILD_COMMAND_ARG="build"
elif [ ${PROJECT_BUILD_METHOD} == "make" ]; then
export PROJECT_BUILD_COMMAND="make"
export PROJECT_BUILD_COMMAND_ARG="-j2"
else
echo "Unknown PROJECT_BUILD_METHOD: `${PROJECT_BUILD_METHOD}`"
exit 1
fi
# 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}
# 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"
# these drivers do not compile for ESP8266 yet
export EXCLUDE_COMPONENTS="encoder max7219 mcp23x17"
;;
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