mirror of
https://github.com/espressif/openthread.git
synced 2026-09-14 05:00:11 +00:00
[size-report] support github actions (#4825)
This commit is contained in:
Executable
+141
@@ -0,0 +1,141 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
setup_arm_gcc_7()
|
||||
{
|
||||
if arm-none-eabi-gcc --version | grep -q 'Arm Embedded Processors 7'; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
(cd /tmp/ \
|
||||
&& wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 \
|
||||
&& tar xjf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2)
|
||||
export PATH=/tmp/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH
|
||||
|
||||
arm-none-eabi-gcc --version
|
||||
}
|
||||
|
||||
size_nrf52840()
|
||||
{
|
||||
mkdir ../output
|
||||
|
||||
# The first parent should be the merge base
|
||||
MERGE_BASE_SHA="$(git cat-file -p "${GITHUB_SHA}" | grep 'parent ' | head -n1 | cut -d' ' -f2)"
|
||||
|
||||
# Fetch base commit in case it is not present
|
||||
git fetch --depth 1 --no-recurse-submodules origin "${MERGE_BASE_SHA}"
|
||||
|
||||
export OT_MERGE_BASE_SHA
|
||||
|
||||
# pull request
|
||||
local 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 -- .
|
||||
git clean -xfd
|
||||
./bootstrap
|
||||
make -f examples/Makefile-nrf52840 "${flags[@]}"
|
||||
mv output/nrf52840 ../output/nrf52840-b
|
||||
|
||||
git checkout -f "${MERGE_BASE_SHA}"
|
||||
git submodule update --init
|
||||
|
||||
# base branch
|
||||
git checkout -- .
|
||||
git clean -xfd
|
||||
./bootstrap
|
||||
make -f examples/Makefile-nrf52840 "${flags[@]}"
|
||||
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 size ../output/nrf52840-a/lib/libopenthread-cli-ftd.a ../output/nrf52840-b/lib/libopenthread-cli-ftd.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-cli-mtd.a ../output/nrf52840-b/lib/libopenthread-cli-mtd.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-ftd.a ../output/nrf52840-b/lib/libopenthread-ftd.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-mtd.a ../output/nrf52840-b/lib/libopenthread-mtd.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-ncp-ftd.a ../output/nrf52840-b/lib/libopenthread-ncp-ftd.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-ncp-mtd.a ../output/nrf52840-b/lib/libopenthread-ncp-mtd.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-rcp.a ../output/nrf52840-b/lib/libopenthread-rcp.a
|
||||
./size-report size ../output/nrf52840-a/lib/libopenthread-radio.a ../output/nrf52840-b/lib/libopenthread-radio.a
|
||||
|
||||
./size-report post
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
if [[ $# == 0 ]]; then
|
||||
setup_arm_gcc_7
|
||||
size_nrf52840
|
||||
elif [[ "$1" == setup ]]; then
|
||||
setup_arm_gcc_7
|
||||
elif [[ "$1" == nrf52840 ]]; then
|
||||
size_nrf52840
|
||||
else
|
||||
echo "USAGE: $0 [setup|nrf52840]"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user