Merge pull request #529 from mintsoft/ci-build-sizing

CI: Output the sizes of the banks
This commit is contained in:
feelfree69 authored and GitHub committed 2026-10-22 18:59:17 +02:00
commit 6638748e3c
5 files changed
+89 -10

No files matched your search

+43 -5
View File
@@ -5,6 +5,10 @@ on:
branches: ['**']
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
@@ -13,18 +17,52 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
path: branch
- uses: actions/checkout@v6
with:
path: main
ref: main
- name: Install dependencies
run: |
apt update
apt install make gcc sdcc xxd python-is-python3 libjson-c-dev zlib1g-dev -y
- name: Run the host-side unit tests
run: make -C test
run: cd branch && make -C test
- name: Check that every machine definition can be compiled
run: make machine_check
run: cd branch && make machine_check
- name: Make project (4x2/RTL8372)
run: make CI=1 MACHINE="KP_9000_6XHML_X2"
run: cd branch && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/branch.map
- name: Make project (8x1/RTL8373)
run: make CI=1 MACHINE="KP_9000_9XHML_X_V3_1"
run: cd branch && make CI=1 MACHINE="KP_9000_9XHML_X_V3_1"
- name: Make project with the health instrumentation
run: make clean && make CI=1 MACHINE="KP_9000_6XHML_X2" HEALTH=1
run: cd branch && make clean && make CI=1 MACHINE="KP_9000_6XHML_X2" HEALTH=1
- name: Make main
run: cd main && make CI=1 MACHINE="KP_9000_6XHML_X2" && cp output/KP_9000_6XHML_X2/rtlplayground.map /tmp/main.map
- 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/html_min | awk '{print "MAIN_WEB="$1}' >> "$GITHUB_ENV"
du -sb branch/output/html_min | awk '{print "BRANCH_WEB="$1}' >>"$GITHUB_ENV"
- name: Update PR comment
uses: marocchino/sticky-pull-request-comment@v3
with:
header: Sizes
message: |
## Image Growth
Commit: ${{ github.sha }}
| Name | Main | Branch |
| --- | --- | --- |
| XSEG | ${{ env.MAIN_XSEG }} bytes | ${{ env.BRANCH_XSEG }} bytes |
| CSEG | ${{ env.MAIN_CSEG }} bytes | ${{ env.BRANCH_CSEG }} bytes |
| DSEG | ${{ env.MAIN_DSEG }} bytes | ${{ env.BRANCH_DSEG }} bytes |
| 1 | ${{ env.MAIN_BANK1 }} bytes | ${{ env.BRANCH_BANK1 }} bytes |
| 2 | ${{ env.MAIN_BANK2 }} bytes | ${{ env.BRANCH_BANK2 }} bytes |
| 3 | ${{ env.MAIN_BANK3 }} bytes | ${{ env.BRANCH_BANK3 }} bytes |
| HTML/JS | ${{ env.MAIN_WEB }} bytes | ${{ env.BRANCH_WEB }} bytes |
+2
View File
@@ -1,6 +1,7 @@
.gitignore
.idea/
output/
output-main/
html_data.c
html_data.h
version.h
@@ -12,3 +13,4 @@ build/
# host-test stand-ins for the two generated headers
!test/stub/html_data.h
!test/stub/version.h
.vscode
+10 -4
View File
@@ -34,7 +34,10 @@ endif
# The board definition being built: one file per MACHINE_* symbol in machine.h.
MACHINE_SRC = machine/$(MACHINE).c
BUILDDIR = output/$(MACHINE)
ifndef BUILDDIR
BUILDDIR = output/$(MACHINE)
endif
VERSION_HEADER := version.h
GIT_VERSION := $(shell git rev-parse --short HEAD)
@@ -61,6 +64,9 @@ endif
# is built, including the tools/ subdirectory.
all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin
bank_size:
tools/bank_occupancy.sh "$(MACHINE)"
create_build_dir:
mkdir -p "$(BUILDDIR)"
mkdir -p "$(BUILDDIR)/uip"
@@ -133,7 +139,7 @@ HTML := $(shell find html -name '*.js' -or -name '*.html' -or -name '*.svg' -or
# Minified copy of the web UI sources, used as the fileadder input.
# The raw html/ sources stay untouched for development; the minified
# copy is a build artifact under output/.
HTML_MIN := output/html_min
HTML_MIN := $(BUILDDIR)/html_min
.PHONY: html_min
html_min: $(HTML)
rm -rf $(HTML_MIN)
@@ -155,7 +161,7 @@ $(VERSION_HEADER): FORCE
httpd: html_data.h
$(SUBDIRS):
$(MAKE) -C $@
$(MAKE) -C $@ BUILDDIR=$(BUILDDIR)
clean: $(SUBDIRSCLEAN)
-rm -f html_data.c html_data.h $(VERSION_HEADER)
@@ -198,7 +204,7 @@ $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.i
tools/output/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@
tools/output/crc_calculator -u $@
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin output/rtlplayground.bin
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin $(BUILDDIR)/../rtlplayground.bin
.PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir
+3 -1
View File
@@ -1,6 +1,8 @@
CC = gcc
CCFLAGS = -Wall -o
BUILDDIR = output
ifndef BUILDDIR
BUILDDIR = output
endif
all: create_build_dir $(BUILDDIR)/injector $(BUILDDIR)/fileadder $(BUILDDIR)/httpd_sim\
$(BUILDDIR)/crc_calculator $(BUILDDIR)/imagebuilder
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
MACHINE="$1"
if [[ ! -s output-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 "$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"
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}')
print_line() {
local name=$1 main=$2 branch=$3
printf '%-20s %-20s %-20s %-20s\n' "$name" "$main" "$branch" "$((branch - main))"
}
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"