Skip to content

Commit 4cdb064

Browse files
jakebaileydeadprogram
authored andcommitted
ci: include Xtensa in size comparisons
1 parent e32508b commit 4cdb064

2 files changed

Lines changed: 41 additions & 37 deletions

File tree

.github/workflows/sizediff-install-pkgs.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/sizediff.yml

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ concurrency:
99

1010
jobs:
1111
sizediff:
12-
# Note: when updating the Ubuntu version, also update the Ubuntu version in
13-
# sizediff-install-pkgs.sh
1412
runs-on: ubuntu-24.04
1513
permissions:
1614
pull-requests: write
@@ -28,18 +26,9 @@ jobs:
2826
with:
2927
fetch-depth: 0 # fetch all history (no sparse checkout)
3028
submodules: true
31-
- name: Install apt dependencies
32-
run: ./.github/workflows/sizediff-install-pkgs.sh
33-
- name: Restore LLVM source cache
34-
uses: actions/cache@v5
35-
id: cache-llvm-source
29+
- uses: ./.github/actions/setup-llvm
3630
with:
37-
key: llvm-source-22-sizediff-v1-${{ hashFiles('llvm-version.txt') }}
38-
path: |
39-
llvm-project/compiler-rt
40-
- name: Download LLVM source
41-
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
42-
run: make llvm-source
31+
save-cache: "false"
4332
- name: Cache Go
4433
uses: actions/cache@v5
4534
with:
@@ -50,35 +39,62 @@ jobs:
5039
- run: make gen-device -j4
5140
- name: Download drivers repo
5241
run: git clone https://github.com/tinygo-org/drivers.git
53-
- name: Save HEAD
54-
run: git branch github-actions-saved-HEAD HEAD
42+
- name: Save PR configuration
43+
id: pr
44+
run: |
45+
# Keep the action available after checking out the base commit.
46+
cp -r .github/actions/setup-llvm .github/actions/setup-llvm-base
47+
echo "base_sha=$(git rev-parse HEAD^1)" >> "$GITHUB_OUTPUT"
48+
echo "llvm_version=$(cat llvm-version.txt)" >> "$GITHUB_OUTPUT"
5549
5650
# Compute sizes for the PR branch
5751
- name: Build tinygo binary for the PR branch
58-
run: go install
52+
run: make tinygo
5953
- name: Determine binary sizes on the PR branch
60-
run: (cd drivers; make smoke-test XTENSA=0 | tee sizes-pr.txt)
54+
run: |
55+
set -o pipefail
56+
export PATH="$PWD/build:$PATH"
57+
(cd drivers; make smoke-test | tee sizes-pr.txt)
6158
6259
# Compute sizes for the dev branch
6360
- name: Checkout dev branch
61+
id: dev
6462
run: |
65-
git reset --hard origin/dev
66-
git checkout --no-recurse-submodules `git merge-base HEAD origin/dev`
67-
- name: Install apt dependencies on the dev branch
68-
# this is only needed on a PR that changes the LLVM version
69-
run: ./.github/workflows/sizediff-install-pkgs.sh
63+
git checkout --force "${{ steps.pr.outputs.base_sha }}"
64+
git submodule update --init
65+
rm -rf build
66+
git clean -fdX src/device
67+
export GOCACHE="$RUNNER_TEMP/go-build-base"
68+
export XDG_CACHE_HOME="$RUNNER_TEMP/cache-base"
69+
echo "GOCACHE=$GOCACHE" >> "$GITHUB_ENV"
70+
echo "XDG_CACHE_HOME=$XDG_CACHE_HOME" >> "$GITHUB_ENV"
71+
make gen-device -j4
72+
echo "llvm_version=$(cat llvm-version.txt)" >> "$GITHUB_OUTPUT"
73+
- name: Remove LLVM build for the PR branch
74+
if: steps.pr.outputs.llvm_version != steps.dev.outputs.llvm_version
75+
run: rm -rf llvm-build llvm-project
76+
- name: Set up LLVM for the dev branch
77+
uses: ./.github/actions/setup-llvm-base
78+
if: steps.pr.outputs.llvm_version != steps.dev.outputs.llvm_version
79+
with:
80+
save-cache: "false"
7081
- name: Build tinygo binary for the dev branch
71-
run: go install
82+
run: make tinygo
7283
- name: Determine binary sizes on the dev branch
73-
run: (cd drivers; make smoke-test XTENSA=0 | tee sizes-dev.txt)
84+
run: |
85+
set -o pipefail
86+
export PATH="$PWD/build:$PATH"
87+
(cd drivers; make smoke-test | tee sizes-dev.txt)
7488
7589
# Create comment
7690
# TODO: add a summary, something like:
7791
# - overall size difference (percent)
7892
# - number of binaries that grew / shrank / remained the same
7993
# - don't show the full diff when no binaries changed
8094
- name: Calculate size diff
81-
run: ./tools/sizediff drivers/sizes-dev.txt drivers/sizes-pr.txt | tee sizediff.txt
95+
run: |
96+
set -o pipefail
97+
./tools/sizediff drivers/sizes-dev.txt drivers/sizes-pr.txt | tee sizediff.txt
8298
- name: Create comment
8399
run: |
84100
echo "Size difference with the dev branch:" > comment.txt

0 commit comments

Comments
 (0)