From 116f9cbdbc840ec63a33ef6223add6fe87524014 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Wed, 7 Aug 2019 00:05:54 +0800 Subject: [PATCH] [travis] generate size report (#4026) This commit splits the jobs into 2 stages: lint, test. In the lint stage, generate size diff report and post into the pull request. --- .travis.yml | 65 +++++++++++++++++++++++++++++---------- .travis/before_install.sh | 2 +- .travis/script.sh | 42 +++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b5b80b81..8f91610b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,74 +40,78 @@ before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi -script: - - .travis/script.sh - after_success: - .travis/after_success.sh -matrix: +stages: + - lint + - test + +jobs: include: - env: BUILD_TARGET="posix-app-cli" VERBOSE=1 VIRTUAL_TIME=1 os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="posix-app-pty" VERBOSE=1 COVERAGE=1 os: linux compiler: clang + script: .travis/script.sh - env: BUILD_TARGET="posix-app-pty" DAEMON=1 VERBOSE=1 COVERAGE=1 os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="android-build" VERBOSE=1 os: linux dist: trusty python: "2.7" + script: .travis/script.sh - env: BUILD_TARGET="posix-distcheck" VERBOSE=1 VIRTUAL_TIME=1 os: linux compiler: clang + script: .travis/script.sh - env: BUILD_TARGET="posix-32-bit" VERBOSE=1 VIRTUAL_TIME=1 os: linux compiler: gcc python: "2.7" + script: .travis/script.sh - env: BUILD_TARGET="posix-32-bit" VERBOSE=1 VIRTUAL_TIME=1 TIME_SYNC=1 os: linux compiler: gcc python: "2.7" + script: .travis/script.sh - env: BUILD_TARGET="posix-ncp" VERBOSE=1 VIRTUAL_TIME=1 os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="posix-mtd" VERBOSE=1 VIRTUAL_TIME=1 os: linux compiler: gcc - - env: BUILD_TARGET="py-pretty-check" - os: linux - python: "2.7" - - env: BUILD_TARGET="pretty-check" - os: linux - addons: - apt: - sources: - - llvm-toolchain-xenial-6.0 - - ubuntu-toolchain-r-test - packages: - - clang-format-6.0 + script: .travis/script.sh - env: BUILD_TARGET="scan-build" os: linux compiler: clang + script: .travis/script.sh - env: BUILD_TARGET="arm-gcc-4" os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="arm-gcc-5" os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="arm-gcc-6" os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="arm-gcc-7" os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="arm-gcc-8" os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="posix" CC="gcc-5" CXX="g++-5" os: linux compiler: gcc @@ -118,6 +122,7 @@ matrix: packages: - gcc-5 - g++-5 + script: .travis/script.sh - env: BUILD_TARGET="posix" CC="gcc-6" CXX="g++-6" os: linux compiler: gcc @@ -128,6 +133,7 @@ matrix: packages: - gcc-6 - g++-6 + script: .travis/script.sh - env: BUILD_TARGET="posix" CC="gcc-7" CXX="g++-7" os: linux compiler: gcc @@ -138,6 +144,7 @@ matrix: packages: - gcc-7 - g++-7 + script: .travis/script.sh - env: BUILD_TARGET="posix" CC="gcc-8" CXX="g++-8" os: linux compiler: gcc @@ -148,6 +155,7 @@ matrix: packages: - gcc-8 - g++-8 + script: .travis/script.sh - env: BUILD_TARGET="posix" CC="gcc-9" CXX="g++-9" os: linux compiler: gcc @@ -158,16 +166,41 @@ matrix: packages: - gcc-9 - g++-9 + script: .travis/script.sh - env: BUILD_TARGET="posix-ncp-spi" VERBOSE=1 os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="toranj-test-framework" VERBOSE=1 os: linux compiler: gcc + script: .travis/script.sh - env: BUILD_TARGET="toranj-test-framework" VERBOSE=1 TORANJ_POSIX_APP_RCP_MODEL=1 os: linux compiler: gcc python: "2.7" + script: .travis/script.sh - env: BUILD_TARGET="osx" VERBOSE=1 os: osx language: generic + script: .travis/script.sh + - stage: lint + env: BUILD_TARGET="py-pretty-check" + os: linux + python: "2.7" + script: .travis/script.sh + - env: BUILD_TARGET="pretty-check" + os: linux + addons: + apt: + sources: + - llvm-toolchain-xenial-6.0 + - ubuntu-toolchain-r-test + packages: + - clang-format-6.0 + script: .travis/script.sh + - env: BUILD_TARGET="size-report" + os: linux + compiler: gcc + script: .travis/script.sh VERBOSE=1 + if: type = pull_request diff --git a/.travis/before_install.sh b/.travis/before_install.sh index a20510f57..d87363210 100755 --- a/.travis/before_install.sh +++ b/.travis/before_install.sh @@ -108,7 +108,7 @@ cd /tmp || die arm-none-eabi-gcc --version || die } - [ $BUILD_TARGET != arm-gcc-7 ] || { + [ $BUILD_TARGET != arm-gcc-7 -a $BUILD_TARGET != size-report ] || { wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 || die tar xjf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 || die export PATH=/tmp/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH || die diff --git a/.travis/script.sh b/.travis/script.sh index 40ea33bd5..151688e5c 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -450,6 +450,48 @@ build_samr21() { ./tests/toranj/start.sh || die } +[ $BUILD_TARGET != size-report ] || { + [ ${TRAVIS_PULL_REQUEST} != false ] || die + + export PATH=/tmp/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH || die + + mkdir ../output + + export MERGE_BASE_SHA=$(git merge-base HEAD ${TRAVIS_BRANCH}) + + # pull request + OPENTHREAD_FLAGS="BORDER_AGENT=1 BORDER_ROUTER=1 CHANNEL_MANAGER=1 CHANNEL_MONITOR=1 CHILD_SUPERVISION=1 COAP=1 COAPS=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DIAGNOSTIC=1 DISABLE_DOC=1 DNS_CLIENT=1 ECDSA=1 FULL_LOGS=1 JAM_DETECTION=1 JOINER=1 LINK_RAW=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 SLAAC=1 SNTP_CLIENT=1 TIME_SYNC=1 UDP_FORWARD=1" + + git checkout -- . || die + git clean -xfd || die + ./bootstrap || die + make -f examples/Makefile-nrf52840 ${OPENTHREAD_FLAGS} || die + mv output/nrf52840 ../output/nrf52840-b + + git checkout ${MERGE_BASE_SHA} + git submodule update --init + + # base branch + git checkout -- . || die + git clean -xfd || die + ./bootstrap || die + make -f examples/Makefile-nrf52840 ${OPENTHREAD_FLAGS} || die + mv output/nrf52840 ../output/nrf52840-a + + curl -s "${SIZE_REPORT_URL}/bash" > size-report + chmod a+x size-report + + ./size-report init OpenThread + + ./size-report size ../output/nrf52840-a/bin/ot-cli-ftd ../output/nrf52840-b/bin/ot-cli-ftd + ./size-report size ../output/nrf52840-a/bin/ot-cli-mtd ../output/nrf52840-b/bin/ot-cli-mtd + ./size-report size ../output/nrf52840-a/bin/ot-ncp-ftd ../output/nrf52840-b/bin/ot-ncp-ftd + ./size-report size ../output/nrf52840-a/bin/ot-ncp-mtd ../output/nrf52840-b/bin/ot-ncp-mtd + ./size-report size ../output/nrf52840-a/bin/ot-rcp ../output/nrf52840-b/bin/ot-rcp + + ./size-report post +} + [ $BUILD_TARGET != osx ] || { git checkout -- . || die git clean -xfd || die