From 79023b0791ef402c94e3b9a45577bcd20c3dfa08 Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 15:13:21 +0200 Subject: [PATCH 1/8] Comment a zephyr RAM and ROM report after building --- .github/workflows/compile.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 25045ac5..bb7a3ff0 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -1,6 +1,10 @@ name: Build on: [push, pull_request] +permissions: + contents: read + pull-requests: write + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true # Cancel in-flight jobs for the same branch or PR @@ -165,3 +169,36 @@ jobs: source ../.venv/bin/activate cd platforms/Zephyr west build -b esp32_devkitc_wroom/esp32/procpu + + - name: Create ROM + RAM report + id: zephyr-size + working-directory: ${{ github.workspace }}/zephyrproject/WARDuino + run: | + source ../.venv/bin/activate + cd platforms/Zephyr + + { + echo "## Zephyr build size report" + echo + echo "### ROM" + echo '```text' + west build -d build -t rom_report + echo '```' + echo + echo "### RAM" + echo '```text' + west build -d build -t ram_report + echo '```' + } > build-size.md + + { + echo "body<> "$GITHUB_OUTPUT" + + - name: Comment Zephyr size report + uses: marocchino/sticky-pull-request-comment@v3 + with: + header: build-size + message: ${{ steps.zephyr-size.outputs.body }} From f4ea085c7127d4b5aa28a0734d8996db4f970f1c Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 15:56:24 +0200 Subject: [PATCH 2/8] Attempt at using actions/cache@v5 to cache the zephyr installation --- .github/workflows/compile.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index bb7a3ff0..52d9a270 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -133,7 +133,21 @@ jobs: sudo apt install --no-install-recommends git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget python3-dev python3-venv python3-tk xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 sudo apt install xxd + - name: Cache Zephyr + id: cache-zephyr + uses: actions/cache@v5 + with: + path: zephyrproject + key: ${{ runner.os }}-zephyr + + - name: Remove WARDuino from cache if present + if: steps.cache-zephyr.outputs.cache-hit == 'true' + working-directory: ${{ github.workspace }}/zephyrproject + run: | + rm -rf WARDuino + - name: Install Zephyr + if: steps.cache-zephyr.outputs.cache-hit != 'true' working-directory: ${{ github.workspace }} run: | python3 -m venv zephyrproject/.venv From 331f15149ce9ad410eacf64e9126522f45f10eea Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 16:15:41 +0200 Subject: [PATCH 3/8] Read comment from file --- .github/workflows/compile.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 52d9a270..ebaa9248 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -205,14 +205,8 @@ jobs: echo '```' } > build-size.md - { - echo "body<> "$GITHUB_OUTPUT" - - name: Comment Zephyr size report uses: marocchino/sticky-pull-request-comment@v3 with: header: build-size - message: ${{ steps.zephyr-size.outputs.body }} + path: zephyrproject/WARDuino/platforms/Zephyr/build-size.md From d9650914b4182d42d2afbee21bf2dcdde4c686d6 Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 16:32:33 +0200 Subject: [PATCH 4/8] Use gh-find-current-pr to determine the pr number --- .github/workflows/compile.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index ebaa9248..51d30508 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -205,8 +205,12 @@ jobs: echo '```' } > build-size.md + - uses: jwalton/gh-find-current-pr@v1 + id: finder + - name: Comment Zephyr size report uses: marocchino/sticky-pull-request-comment@v3 with: header: build-size + number: ${{ steps.finder.outputs.pr }} path: zephyrproject/WARDuino/platforms/Zephyr/build-size.md From 99a8bf45da82d22acf1ff36a3368ae87d7e609df Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 16:37:55 +0200 Subject: [PATCH 5/8] Run zephyr-export when loading from cache --- .github/workflows/compile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 51d30508..f290a1f9 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -145,6 +145,12 @@ jobs: working-directory: ${{ github.workspace }}/zephyrproject run: | rm -rf WARDuino + + source .venv/bin/activate + west zephyr-export + + cd zephyr + west sdk install - name: Install Zephyr if: steps.cache-zephyr.outputs.cache-hit != 'true' From fdce8f5837968be44bc73837132ad57893aaf030 Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 16:57:30 +0200 Subject: [PATCH 6/8] Only report total ROM usage in bytes The full rom report does not fit into a GitHub comment. --- .github/workflows/compile.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index f290a1f9..434c6220 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -197,19 +197,11 @@ jobs: source ../.venv/bin/activate cd platforms/Zephyr - { - echo "## Zephyr build size report" - echo - echo "### ROM" - echo '```text' - west build -d build -t rom_report - echo '```' - echo - echo "### RAM" - echo '```text' - west build -d build -t ram_report - echo '```' - } > build-size.md + echo "## Zephyr build size report" > build-size.md + echo "### ROM" >> build-size.md + echo '```text' >> build-size.md + echo $(west build -t rom_report | tail -n1 | tr -d " " | numfmt --to=iec --format="%.2f") >> build-size.md + echo '```' >> build-size.md - uses: jwalton/gh-find-current-pr@v1 id: finder From de66543ac31feb14393de85a237a56bb7cfa9128 Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 17:38:05 +0200 Subject: [PATCH 7/8] Also cache the Zephyr SDK --- .github/workflows/compile.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 434c6220..fdbd3551 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -148,9 +148,6 @@ jobs: source .venv/bin/activate west zephyr-export - - cd zephyr - west sdk install - name: Install Zephyr if: steps.cache-zephyr.outputs.cache-hit != 'true' @@ -169,8 +166,19 @@ jobs: west packages pip --install - cd zephyr - west sdk install + - name: Cache Zephyr SDK + id: cache-zephyr-sdk + uses: actions/cache@v5 + with: + path: zephyr-sdk + key: ${{ runner.os }}-zephyr-sdk + + - name: Install Zephyr SDK + if: steps.cache-zephyr-sdk.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/zephyrproject + run: | + source .venv/bin/activate + west sdk install --install-dir zephyr-sdk - name: Checkout repository uses: actions/checkout@v6 From 4825d3a119ac7c9d987be6857b1ed574095c988d Mon Sep 17 00:00:00 2001 From: MaartenS11 Date: Fri, 15 May 2026 17:53:35 +0200 Subject: [PATCH 8/8] Also cache the Zephyr SDK --- .github/workflows/compile.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index fdbd3551..c5a2b0e9 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -178,7 +178,7 @@ jobs: working-directory: ${{ github.workspace }}/zephyrproject run: | source .venv/bin/activate - west sdk install --install-dir zephyr-sdk + west sdk install --install-dir ${{ github.workspace }}/zephyr-sdk - name: Checkout repository uses: actions/checkout@v6 @@ -192,6 +192,8 @@ jobs: cp tests/compilation/esp32/upload.wasm platforms/Zephyr/upload.wasm - name: Build ESP32 target + env: + Zephyr-sdk_DIR: ${{ github.workspace }}/zephyr-sdk/cmake working-directory: ${{ github.workspace }}/zephyrproject/WARDuino run: | source ../.venv/bin/activate