forked from pulkin/micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
367 lines (345 loc) · 15.6 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# global options
dist: xenial
language:
- c
compiler:
- gcc
cache:
directories:
- "${HOME}/persist"
env:
global:
- MAKEOPTS="-j4"
git:
submodules: false
# define the successive stages
stages:
- name: test
# define the jobs for the stages
# approx order of the jobs has longest running first to optimise total time
jobs:
include:
# check code formatting
- stage: test
os: linux
dist: bionic
env: NAME="code formatting"
before_install:
- sudo apt-add-repository --yes --update ppa:pybricks/ppa
install:
- sudo apt-get install uncrustify python3-pip
- uncrustify --version
- pip3 install --user black
- black --version
script:
- tools/codeformat.py
- git diff --exit-code
# unix port on OSX (first in list because the build VM takes a long time to start)
- stage: test
os: osx
osx_image: xcode11.3
env:
- NAME="unix port build with clang on OSX"
- PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/unix submodules
- make ${MAKEOPTS} -C ports/unix deplibs
- make ${MAKEOPTS} -C ports/unix
# OSX has poor time resolution and the following tests do not have the correct output
- (cd tests && ./run-tests --exclude 'uasyncio_(basic|heaplock|lock|wait_task)')
# check for additional compiler errors/warnings
- make ${MAKEOPTS} -C ports/unix VARIANT=coverage submodules
- make ${MAKEOPTS} -C ports/unix VARIANT=coverage
after_failure:
- tests/run-tests --print-failures
# stm32 port
- stage: test
env: NAME="stm32 port build"
install:
# need newer gcc version for Cortex-M7 support
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
- sudo apt-get update -qq || true
- sudo apt-get install gcc-arm-embedded
- sudo apt-get install libnewlib-arm-none-eabi
- arm-none-eabi-gcc --version
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/stm32 submodules
- git submodule update --init lib/btstack
- make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_F091RC
- make ${MAKEOPTS} -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=5200 MICROPY_PY_CC3K=1
- make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF2
- make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF6 NANBOX=1 MICROPY_BLUETOOTH_NIMBLE=0 MICROPY_BLUETOOTH_BTSTACK=1
- make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
- make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L073RZ
- make ${MAKEOPTS} -C ports/stm32 BOARD=STM32L476DISC
- make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_WB55
- make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBD_SF6
# qemu-arm port
- stage: test
dist: bionic # needed for more recent version of qemu-system-arm with mps2-an385 target
env: NAME="qemu-arm port build and tests"
install:
- sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi
- sudo apt-get install qemu-system
- arm-none-eabi-gcc --version
- qemu-system-arm --version
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/qemu-arm -f Makefile.test test
after_failure:
- grep --text "FAIL" ports/qemu-arm/build/console.out
# unix coverage
- stage: test
env: NAME="unix coverage build and tests"
install:
- sudo apt-get install python3-pip
- sudo pip install cpp-coveralls
- sudo pip3 install setuptools
- sudo pip3 install pyelftools
- gcc --version
- python3 --version
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/unix VARIANT=coverage submodules
- make ${MAKEOPTS} -C ports/unix VARIANT=coverage deplibs
- make ${MAKEOPTS} -C ports/unix VARIANT=coverage
# run the main test suite
- make -C ports/unix VARIANT=coverage test_full
- (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-multitests.py multi_net/*.py) || travis_terminate 1
# test building native mpy modules
- make -C examples/natmod/features1 ARCH=x64
- make -C examples/natmod/features2 ARCH=x64
- make -C examples/natmod/btree ARCH=x64
- make -C examples/natmod/framebuf ARCH=x64
- make -C examples/natmod/uheapq ARCH=x64
- make -C examples/natmod/urandom ARCH=x64
- make -C examples/natmod/ure ARCH=x64
- make -C examples/natmod/uzlib ARCH=x64
# test importing .mpy generated by mpy_ld.py
- MICROPYPATH=examples/natmod/features2 ./ports/unix/micropython-coverage -m features2
- (cd tests && ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py)
# run coveralls coverage analysis (try to, even if some builds/tests failed)
- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
after_failure:
- tests/run-tests --print-failures
# unix coverage 32-bit
- stage: test
env: NAME="unix coverage 32-bit build and tests"
install:
- sudo apt-get install gcc-multilib libffi-dev:i386
- sudo apt-get install python3-pip
- sudo pip3 install setuptools
- sudo pip3 install pyelftools
- gcc --version
- python3 --version
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 VARIANT=coverage submodules
- make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 VARIANT=coverage deplibs
- make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 VARIANT=coverage
# run the main test suite
- make -C ports/unix MICROPY_FORCE_32BIT=1 VARIANT=coverage test_full || travis_terminate 1
# test building native mpy modules
- make -C examples/natmod/features1 ARCH=x86
- make -C examples/natmod/features2 ARCH=x86
- make -C examples/natmod/btree ARCH=x86
- make -C examples/natmod/framebuf ARCH=x86
- make -C examples/natmod/uheapq ARCH=x86
- make -C examples/natmod/urandom ARCH=x86
- make -C examples/natmod/ure ARCH=x86
- make -C examples/natmod/uzlib ARCH=x86
# test importing .mpy generated by mpy_ld.py
- MICROPYPATH=examples/natmod/features2 ./ports/unix/micropython-coverage -m features2
- (cd tests && ./run-natmodtests.py --arch x86 extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py)
after_failure:
- tests/run-tests --print-failures
# standard unix port
- stage: test
env: NAME="unix port build and tests"
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/unix submodules
- make ${MAKEOPTS} -C ports/unix deplibs
- make ${MAKEOPTS} -C ports/unix
- make ${MAKEOPTS} -C ports/unix test
- (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython ./run-perfbench.py 1000 1000)
after_failure:
- tests/run-tests --print-failures
# unix nanbox/float (and using Python 2 to check it can run the build scripts)
- stage: test
env: NAME="unix nanbox/float port build and tests"
install:
- sudo apt-get install gcc-multilib libffi-dev:i386
script:
- make ${MAKEOPTS} -C mpy-cross PYTHON=python2
- make ${MAKEOPTS} -C ports/unix VARIANT=nanbox submodules
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 VARIANT=nanbox deplibs
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 VARIANT=nanbox
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 VARIANT=nanbox test_full || travis_terminate 1
- make ${MAKEOPTS} -C ports/unix clean
- make ${MAKEOPTS} -C ports/unix CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
- make ${MAKEOPTS} -C ports/unix test
after_failure:
- tests/run-tests --print-failures
# unix stackless/float with clang
- stage: test
env: NAME="unix stackless/float port build and tests with clang"
install:
- sudo apt-get install clang
script:
- make ${MAKEOPTS} -C mpy-cross CC=clang
- make ${MAKEOPTS} -C ports/unix submodules
- make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1"
- make ${MAKEOPTS} -C ports/unix CC=clang test || travis_terminate 1
- make ${MAKEOPTS} -C ports/unix clean
- make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
- make ${MAKEOPTS} -C ports/unix CC=clang test
after_failure:
- tests/run-tests --print-failures
# unix with sys.settrace
- stage: test
env: NAME="unix port with sys.settrace build and tests"
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/unix MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA="-DMICROPY_PY_SYS_SETTRACE=1" test || travis_terminate 1
- make ${MAKEOPTS} -C ports/unix clean
- make ${MAKEOPTS} -C ports/unix MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1 -DMICROPY_PY_SYS_SETTRACE=1" test
after_failure:
- tests/run-tests --print-failures
# minimal unix port with tests
- stage: test
env: NAME="minimal unix port build and tests"
script:
- make ${MAKEOPTS} -C ports/unix VARIANT=minimal
- (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython-minimal ./run-tests -e exception_chain -e self_type_check -e subclass_native_init -d basics)
after_failure:
- tests/run-tests --print-failures
# windows port via mingw
- stage: test
env: NAME="windows port build via mingw"
install:
- sudo apt-get install gcc-mingw-w64
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/windows CROSS_COMPILE=i686-w64-mingw32-
# esp32 w/ESP-IDFv3 port
- stage: test
env: NAME="esp32 ESP-IDFv3 port build"
install:
- sudo apt-get install python3-pip
- sudo pip3 install 'pyparsing<2.4'
- curl -L https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz | tar zxf -
- export PATH=$(pwd)/xtensa-esp32-elf/bin:$PATH
- git clone https://github.com/espressif/esp-idf.git
- export IDF_PATH=$(pwd)/esp-idf
script:
- make ${MAKEOPTS} -C mpy-cross
- git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V3 :=" ports/esp32/Makefile | cut -d " " -f 3)
- git -C esp-idf submodule update --init components/json/cJSON components/esp32/lib components/esptool_py/esptool components/expat/expat components/lwip/lwip components/mbedtls/mbedtls components/micro-ecc/micro-ecc components/nghttp/nghttp2 components/nimble components/bt
- make ${MAKEOPTS} -C ports/esp32 submodules
- make ${MAKEOPTS} -C ports/esp32
# esp32 w/ESP-IDFv4 port
- stage: test
env: NAME="esp32 ESP-IDFv4 port build"
install:
- sudo apt-get install python3-pip
- sudo pip3 install 'pyparsing<2.4'
- curl -L https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-linux-amd64.tar.gz | tar zxf -
- export PATH=$(pwd)/xtensa-esp32-elf/bin:$PATH
- git clone https://github.com/espressif/esp-idf.git
- export IDF_PATH=$(pwd)/esp-idf
script:
- make ${MAKEOPTS} -C mpy-cross
- git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V4 :=" ports/esp32/Makefile | cut -d " " -f 3)
- git -C esp-idf submodule update --init components/bt/controller/lib components/bt/host/nimble/nimble components/esp_wifi/lib_esp32 components/esptool_py/esptool components/lwip/lwip components/mbedtls/mbedtls
- make ${MAKEOPTS} -C ports/esp32 submodules
- make ${MAKEOPTS} -C ports/esp32
# esp8266 port
- stage: test
env: NAME="esp8266 port build"
install:
- wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz
- zcat xtensa-lx106-elf-standalone.tar.gz | tar x
- export PATH=$(pwd)/xtensa-lx106-elf/bin:$PATH
script:
- make ${MAKEOPTS} -C mpy-cross
- make ${MAKEOPTS} -C ports/esp8266 submodules
- make ${MAKEOPTS} -C ports/esp8266
- make ${MAKEOPTS} -C ports/esp8266 BOARD=GENERIC_512K
- make ${MAKEOPTS} -C ports/esp8266 BOARD=GENERIC_1M
# nrf port
- stage: test
env: NAME="nrf port build"
install:
- sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi
- arm-none-eabi-gcc --version
script:
- make ${MAKEOPTS} -C ports/nrf submodules
- make ${MAKEOPTS} -C ports/nrf BOARD=pca10040
- make ${MAKEOPTS} -C ports/nrf BOARD=microbit
- make ${MAKEOPTS} -C ports/nrf BOARD=pca10056
# bare-arm and minimal ports, with size-diff check
- stage: test
env: NAME="bare-arm and minimal ports build and size-diff check"
install:
- sudo apt-get install gcc-multilib libffi-dev:i386
- sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi
- gcc --version
- arm-none-eabi-gcc --version
script:
# starts off at either the ref/pull/N/merge FETCH_HEAD, or the current branch HEAD
- git checkout -b pull_request # save the current location
- git remote add upstream https://github.com/micropython/micropython.git
- git fetch --depth=100 upstream
# build reference, save to size0
# ignore any errors with this build, in case master is failing
- git checkout `git merge-base --fork-point upstream/master pull_request`
- git show -s
- tools/metrics.py clean bm
- tools/metrics.py build bm | tee ~/size0 || true
# build PR/branch, save to size1
- git checkout pull_request
- git log upstream/master..HEAD
- tools/metrics.py clean bm
- tools/metrics.py build bm | tee ~/size1 || travis_terminate 1
# compute diff of the code sizes
- tools/metrics.py diff --error-threshold 0 ~/size0 ~/size1
# cc3200 port
- stage: test
env: NAME="cc3200 port build"
install:
- sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi
script:
- make ${MAKEOPTS} -C ports/cc3200 BTARGET=application BTYPE=release
- make ${MAKEOPTS} -C ports/cc3200 BTARGET=bootloader BTYPE=release
# samd port
- stage: test
env: NAME="samd port build"
install:
- sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi
script:
- make ${MAKEOPTS} -C ports/samd submodules
- make ${MAKEOPTS} -C ports/samd
# teensy port
- stage: test
env: NAME="teensy port build"
install:
- sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi
script:
- make ${MAKEOPTS} -C ports/teensy
# powerpc port
- stage: test
env: NAME="powerpc port build"
install:
- sudo apt-get install gcc-powerpc64le-linux-gnu
- sudo apt-get install libc6-dev-ppc64el-cross
script:
- make ${MAKEOPTS} -C ports/powerpc CROSS_COMPILE=powerpc64le-linux-gnu-