travis: Use tools/metrics.py to compute size diff of minimal ports.

This is to make the Travis CI size check more robust, by not relying on the
saved firmware from a previous build (which may use a different compiler,
environment, etc) but rather compile both master and the PR and diff them.

This size check now checks both bare-arm and minimal x86-32 builds (before
it just checked minimal Cortex-M build).
This commit is contained in:
Damien George 2020-04-19 09:16:36 +10:00
parent 17dc86369f
commit 8267f0866c

View File

@ -297,21 +297,26 @@ jobs:
- make ${MAKEOPTS} -C ports/nrf submodules - make ${MAKEOPTS} -C ports/nrf submodules
- make ${MAKEOPTS} -C ports/nrf - make ${MAKEOPTS} -C ports/nrf
# bare-arm and minimal ports # bare-arm and minimal ports, with size-diff check
- stage: test - stage: test
env: NAME="bare-arm and minimal ports build" env: NAME="bare-arm and minimal ports build and size-diff check"
install: install:
- sudo apt-get install gcc-multilib libffi-dev:i386
- sudo apt-get install gcc-arm-none-eabi - sudo apt-get install gcc-arm-none-eabi
- sudo apt-get install libnewlib-arm-none-eabi - sudo apt-get install libnewlib-arm-none-eabi
- gcc --version
- arm-none-eabi-gcc --version - arm-none-eabi-gcc --version
script: script:
- make ${MAKEOPTS} -C ports/bare-arm - git checkout -b pull_request
- make ${MAKEOPTS} -C ports/minimal CROSS=1 build/firmware.bin - git checkout master
- ls -l ports/minimal/build/firmware.bin - git show -s
- tools/check_code_size.sh - tools/metrics.py clean bm
- mkdir -p ${HOME}/persist - tools/metrics.py build bm | tee ~/size0 || travis_terminate 1
# Save new firmware for reference, but only if building a main branch, not a pull request - git checkout pull_request
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi' - git show -s
- tools/metrics.py clean bm
- tools/metrics.py build bm | tee ~/size1 || travis_terminate 1
- tools/metrics.py diff --error-threshold 0 ~/size0 ~/size1
# cc3200 port # cc3200 port
- stage: test - stage: test