mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-10 22:49:30 +00:00
ci: include Xtensa in size comparisons
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
# Command that's part of sizediff.yml. This is put in a separate file so that it
|
|
||||||
# still works after checking out the dev branch (that is, when going from LLVM
|
|
||||||
# 16 to LLVM 17 for example, both Clang 16 and Clang 17 are installed).
|
|
||||||
|
|
||||||
echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-20 main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install --no-install-recommends -y \
|
|
||||||
llvm-20-dev \
|
|
||||||
clang-20 \
|
|
||||||
libclang-20-dev \
|
|
||||||
lld-20
|
|
||||||
@@ -9,8 +9,6 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sizediff:
|
sizediff:
|
||||||
# Note: when updating the Ubuntu version, also update the Ubuntu version in
|
|
||||||
# sizediff-install-pkgs.sh
|
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
@@ -28,18 +26,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0 # fetch all history (no sparse checkout)
|
fetch-depth: 0 # fetch all history (no sparse checkout)
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Install apt dependencies
|
- uses: ./.github/actions/setup-llvm
|
||||||
run: ./.github/workflows/sizediff-install-pkgs.sh
|
|
||||||
- name: Restore LLVM source cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
id: cache-llvm-source
|
|
||||||
with:
|
with:
|
||||||
key: llvm-source-22-sizediff-v1-${{ hashFiles('llvm-version.txt') }}
|
save-cache: "false"
|
||||||
path: |
|
|
||||||
llvm-project/compiler-rt
|
|
||||||
- name: Download LLVM source
|
|
||||||
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
|
|
||||||
run: make llvm-source
|
|
||||||
- name: Cache Go
|
- name: Cache Go
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
@@ -50,27 +39,52 @@ jobs:
|
|||||||
- run: make gen-device -j4
|
- run: make gen-device -j4
|
||||||
- name: Download drivers repo
|
- name: Download drivers repo
|
||||||
run: git clone https://github.com/tinygo-org/drivers.git
|
run: git clone https://github.com/tinygo-org/drivers.git
|
||||||
- name: Save HEAD
|
- name: Save PR configuration
|
||||||
run: git branch github-actions-saved-HEAD HEAD
|
id: pr
|
||||||
|
run: |
|
||||||
|
# Keep the action available after checking out the base commit.
|
||||||
|
cp -r .github/actions/setup-llvm .github/actions/setup-llvm-base
|
||||||
|
echo "base_sha=$(git rev-parse HEAD^1)" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "llvm_version=$(cat llvm-version.txt)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# Compute sizes for the PR branch
|
# Compute sizes for the PR branch
|
||||||
- name: Build tinygo binary for the PR branch
|
- name: Build tinygo binary for the PR branch
|
||||||
run: go install
|
run: make tinygo
|
||||||
- name: Determine binary sizes on the PR branch
|
- name: Determine binary sizes on the PR branch
|
||||||
run: (cd drivers; make smoke-test XTENSA=0 | tee sizes-pr.txt)
|
run: |
|
||||||
|
set -o pipefail
|
||||||
|
export PATH="$PWD/build:$PATH"
|
||||||
|
(cd drivers; make smoke-test | tee sizes-pr.txt)
|
||||||
|
|
||||||
# Compute sizes for the dev branch
|
# Compute sizes for the dev branch
|
||||||
- name: Checkout dev branch
|
- name: Checkout dev branch
|
||||||
|
id: dev
|
||||||
run: |
|
run: |
|
||||||
git reset --hard origin/dev
|
git checkout --force "${{ steps.pr.outputs.base_sha }}"
|
||||||
git checkout --no-recurse-submodules `git merge-base HEAD origin/dev`
|
git submodule update --init
|
||||||
- name: Install apt dependencies on the dev branch
|
rm -rf build
|
||||||
# this is only needed on a PR that changes the LLVM version
|
git clean -fdX src/device
|
||||||
run: ./.github/workflows/sizediff-install-pkgs.sh
|
export GOCACHE="$RUNNER_TEMP/go-build-base"
|
||||||
|
export XDG_CACHE_HOME="$RUNNER_TEMP/cache-base"
|
||||||
|
echo "GOCACHE=$GOCACHE" >> "$GITHUB_ENV"
|
||||||
|
echo "XDG_CACHE_HOME=$XDG_CACHE_HOME" >> "$GITHUB_ENV"
|
||||||
|
make gen-device -j4
|
||||||
|
echo "llvm_version=$(cat llvm-version.txt)" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: Remove LLVM build for the PR branch
|
||||||
|
if: steps.pr.outputs.llvm_version != steps.dev.outputs.llvm_version
|
||||||
|
run: rm -rf llvm-build llvm-project
|
||||||
|
- name: Set up LLVM for the dev branch
|
||||||
|
uses: ./.github/actions/setup-llvm-base
|
||||||
|
if: steps.pr.outputs.llvm_version != steps.dev.outputs.llvm_version
|
||||||
|
with:
|
||||||
|
save-cache: "false"
|
||||||
- name: Build tinygo binary for the dev branch
|
- name: Build tinygo binary for the dev branch
|
||||||
run: go install
|
run: make tinygo
|
||||||
- name: Determine binary sizes on the dev branch
|
- name: Determine binary sizes on the dev branch
|
||||||
run: (cd drivers; make smoke-test XTENSA=0 | tee sizes-dev.txt)
|
run: |
|
||||||
|
set -o pipefail
|
||||||
|
export PATH="$PWD/build:$PATH"
|
||||||
|
(cd drivers; make smoke-test | tee sizes-dev.txt)
|
||||||
|
|
||||||
# Create comment
|
# Create comment
|
||||||
# TODO: add a summary, something like:
|
# TODO: add a summary, something like:
|
||||||
@@ -78,7 +92,9 @@ jobs:
|
|||||||
# - number of binaries that grew / shrank / remained the same
|
# - number of binaries that grew / shrank / remained the same
|
||||||
# - don't show the full diff when no binaries changed
|
# - don't show the full diff when no binaries changed
|
||||||
- name: Calculate size diff
|
- name: Calculate size diff
|
||||||
run: ./tools/sizediff drivers/sizes-dev.txt drivers/sizes-pr.txt | tee sizediff.txt
|
run: |
|
||||||
|
set -o pipefail
|
||||||
|
./tools/sizediff drivers/sizes-dev.txt drivers/sizes-pr.txt | tee sizediff.txt
|
||||||
- name: Create comment
|
- name: Create comment
|
||||||
run: |
|
run: |
|
||||||
echo "Size difference with the dev branch:" > comment.txt
|
echo "Size difference with the dev branch:" > comment.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user