Merge pull request #728 from DrDoof/ci/size-summary

ci: show the size of the build next to main in the job summary
This commit is contained in:
feelfree69 authored and GitHub committed 2026-10-29 21:55:33 +01:00
commit 3df406a057
2 files changed
+31 -27

No files matched your search

+3 -8
View File
@@ -7,8 +7,6 @@ on:
permissions:
contents: read
pull-requests: write
issues: write
jobs:
build:
@@ -40,7 +38,7 @@ jobs:
- name: Check that every machine definition can be compiled
run: cd branch && make machine_check
- name: Make project (4x2/RTL8372)
run: cd branch && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/branch.map
run: mkdir -p /tmp/branch /tmp/main && cd branch && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp -r output/KP_9000_6XHML_X2/rtlplayground.map output/KP_9000_6XHML_X2/rtlplayground.mem output/KP_9000_6XHML_X2/html_min /tmp/branch/
- name: Make project (8x1/RTL8373)
run: cd branch && make CI=1 MACHINE="KP_9000_9XHML_X_V3_1"
- name: Make project with the health instrumentation
@@ -49,10 +47,7 @@ jobs:
run: |
ln -s ../branch/toolchain main/toolchain
PATH="$(echo "$PWD"/branch/toolchain/sdcc-*/bin):$PATH"
cd main && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/main.map
cd main && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp -r output/KP_9000_6XHML_X2/rtlplayground.map output/KP_9000_6XHML_X2/rtlplayground.mem output/KP_9000_6XHML_X2/html_min /tmp/main/
- name: Calculate bank growth
run: |
sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/MAIN_\1=\3/p' /tmp/main.map | sort -u >> "$GITHUB_ENV"
sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/BRANCH_\1=\3/p' /tmp/branch.map | sort -u >> "$GITHUB_ENV"
du -sb main/output/KP_9000_6XHML_X2/html_min | awk '{print "MAIN_WEB="$1}' >> "$GITHUB_ENV"
du -sb branch/output/KP_9000_6XHML_X2/html_min | awk '{print "BRANCH_WEB="$1}' >>"$GITHUB_ENV"
bash branch/tools/bank_occupancy.sh KP_9000_6XHML_X2 /tmp/main /tmp/branch >> "$GITHUB_STEP_SUMMARY"
+28 -19
View File
@@ -1,31 +1,40 @@
#!/bin/bash
MACHINE="$1"
if [[ ! -s output-main/rtlplayground.map ]]; then
MAIN="${2:-output-main}"
BRANCH="${3:-output/$MACHINE}"
if [[ ! -s "$MAIN/rtlplayground.map" ]]; then
original_branch=$(git branch --show-current)
#trap 'git switch "$original_branch"' EXIT
git switch main && make CI=1 MACHINE="$MACHINE" BUILDDIR=output-main
git switch main && make CI=1 MACHINE="$MACHINE" BUILDDIR="$MAIN"
git switch "$original_branch"
fi
source <(sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/main_\1=\3/p' output-main/rtlplayground.map | sort -u)
main_WEB=$(du -sb output-main/html_min | awk '{print $1}')
if [[ ! -s "output/$MACHINE/rtlplayground.map" ]]; then
make CI=1 MACHINE="$MACHINE"
if [[ ! -s "$BRANCH/rtlplayground.map" ]]; then
make CI=1 MACHINE="$MACHINE" BUILDDIR="$BRANCH"
fi
source <(sed -rn 's/^([XCD]SEG|(BANK[0-9])).*=\s+([0-9]+)\. bytes.*$/branch_\1=\3/p' output/"$MACHINE"/rtlplayground.map | sort -u)
branch_WEB=$(du -sb output/html_min | awk '{print $1}')
seg() {
sed -rn "s/^$1[^=]*=\s+([0-9]+)\. bytes.*$/\1/p" "$2/rtlplayground.map" | head -n 1
}
stack() {
sed -rn 's/.* with ([0-9]+) bytes available.*/\1/p' "$1/rtlplayground.mem"
}
web() {
du -sb "$1/html_min" | awk '{print $1}'
}
print_line() {
local name=$1 main=$2 branch=$3
printf '%-20s %-20s %-20s %-20s\n' "$name" "$main" "$branch" "$((branch - main))"
printf '| %-15s | %7s | %7s | %7s |\n' "$name" "$main" "$branch" "$((${branch:-0} - ${main:-0}))"
}
printf '%-20s %-20s %-20s %-20s\n' "segment" "main" "branch" "change"
print_line "BANK1" "$main_BANK1" "$branch_BANK1"
print_line "BANK2" "$main_BANK2" "$branch_BANK2"
print_line "BANK3" "$main_BANK3" "$branch_BANK3"
print_line "CSEG" "$main_CSEG" "$branch_CSEG"
print_line "DSEG" "$main_DSEG" "$branch_DSEG"
print_line "XSEG" "$main_XSEG" "$branch_XSEG"
print_line "WEB" "$main_WEB" "$branch_WEB"
echo "### $MACHINE"
echo
printf '| %-15s | %7s | %7s | %7s |\n' "segment" "main" "branch" "change"
echo "| --------------- | ------: | ------: | ------: |"
for s in HOME CSEG BANK1 BANK2 BANK3 BANK4 DSEG XSEG; do
print_line "$s" "$(seg "$s" "$MAIN")" "$(seg "$s" "$BRANCH")"
done
print_line "stack available" "$(stack "$MAIN")" "$(stack "$BRANCH")"
print_line "WEB" "$(web "$MAIN")" "$(web "$BRANCH")"