InfiniTime/.github/workflows/getSize.sh
Riku Isokoski 028d40860d 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.
2023-01-07 18:56:15 +02:00

20 lines
500 B
Bash
Executable file

#!/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"