From 028d40860dc32a96ce70bf820053ec93bd52f36d Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 7 Jan 2023 18:15:37 +0200 Subject: workflows: Add build size comparison workflow Add .github/workflows/getSize.sh to extract sizes of sections from the objfile build-firmware uses getSize.sh to output the section sizes. get-base-ref-size job added, which builds the base branch of the PR and outputs the section sizes. Caches are used to avoid unnecessary builds when the base branch hasn't been updated. leave-build-size-comment job added, which creates or updates a comment on the PR with the build size information from other jobs. --- .github/workflows/getSize.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .github/workflows/getSize.sh (limited to '.github/workflows/getSize.sh') diff --git a/.github/workflows/getSize.sh b/.github/workflows/getSize.sh new file mode 100755 index 00000000..52a86132 --- /dev/null +++ b/.github/workflows/getSize.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Requires environment variables from docker/build.sh + +set -e + +SIZE_BIN="$TOOLS_DIR/$GCC_ARM_PATH/bin/arm-none-eabi-size" +[ ! -x "$SIZE_BIN" ] && exit 1 + +[ -z "$1" ] && exit 1 +SIZE_OUTPUT=$($SIZE_BIN "$1" | tail -n1) + +TEXT_SIZE=$(echo "$SIZE_OUTPUT" | cut -f 1 |tr -d '[:blank:]') +DATA_SIZE=$(echo "$SIZE_OUTPUT" | cut -f 2 |tr -d '[:blank:]') +BSS_SIZE=$(echo "$SIZE_OUTPUT" | cut -f 3 |tr -d '[:blank:]') + +echo "text_size=$TEXT_SIZE" +echo "data_size=$DATA_SIZE" +echo "bss_size=$BSS_SIZE" -- cgit v1.2.3-70-g09d2