Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/actions/setup-llvm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Set up LLVM
description: Restore or build the LLVM source and build directories

inputs:
cache-suffix:
description: Suffix for the LLVM cache keys
required: false
default: linux-asserts-v1
assertions:
description: Enable LLVM assertions
required: false
default: "1"

runs:
using: composite
steps:
- name: Restore LLVM source cache
uses: actions/cache/restore@v5
id: cache-llvm-source
with:
key: llvm-source-22-${{ inputs.cache-suffix }}-${{ hashFiles('llvm-version.txt') }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Download LLVM source
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
shell: bash
run: make llvm-source
- name: Save LLVM source cache
uses: actions/cache/save@v5
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Restore LLVM build cache
uses: actions/cache/restore@v5
id: cache-llvm-build
with:
key: llvm-build-22-${{ inputs.cache-suffix }}-${{ hashFiles('llvm-version.txt') }}
path: llvm-build
- name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
shell: bash
run: |
rm -rf llvm-project
make llvm-source
make llvm-build ASSERT=${{ inputs.assertions }}
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
- name: Save LLVM build cache
uses: actions/cache/save@v5
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
path: llvm-build
48 changes: 1 addition & 47 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,53 +264,7 @@ jobs:
"https://github.com/espressif/qemu/releases/download/$release/$archive"
tar -xJf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/qemu/bin" >> "$GITHUB_PATH"
- name: Restore LLVM source cache
uses: actions/cache/restore@v5
id: cache-llvm-source
with:
key: llvm-source-22-linux-asserts-v1-${{ hashFiles('llvm-version.txt') }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Download LLVM source
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
run: make llvm-source
- name: Save LLVM source cache
uses: actions/cache/save@v5
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/compiler-rt
llvm-project/lld/include
llvm-project/llvm/include
- name: Restore LLVM build cache
uses: actions/cache/restore@v5
id: cache-llvm-build
with:
key: llvm-build-22-linux-asserts-v1-${{ hashFiles('llvm-version.txt') }}
path: llvm-build
- name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
run: |
# fetch LLVM source
rm -rf llvm-project
make llvm-source
# build!
make llvm-build ASSERT=1
# Remove unnecessary object files (to reduce cache size).
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
- name: Save LLVM build cache
uses: actions/cache/save@v5
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
path: llvm-build
- uses: ./.github/actions/setup-llvm
- name: Cache Binaryen
uses: actions/cache@v5
id: cache-binaryen
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/sizediff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,7 @@ jobs:
submodules: true
- name: Install apt dependencies
run: ./.github/workflows/sizediff-install-pkgs.sh
- name: Restore LLVM source cache
uses: actions/cache@v5
id: cache-llvm-source
with:
key: llvm-source-22-sizediff-v1-${{ hashFiles('llvm-version.txt') }}
path: |
llvm-project/compiler-rt
- name: Download LLVM source
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
run: make llvm-source
- uses: ./.github/actions/setup-llvm
- name: Cache Go
uses: actions/cache@v5
with:
Expand All @@ -51,26 +42,44 @@ jobs:
- name: Download drivers repo
run: git clone https://github.com/tinygo-org/drivers.git
- name: Save HEAD
run: git branch github-actions-saved-HEAD HEAD
id: pr
run: |
git branch github-actions-saved-HEAD HEAD
cp -r .github/actions/setup-llvm .github/actions/setup-llvm-base
echo "llvm_version=$(cat llvm-version.txt)" >> "$GITHUB_OUTPUT"

# Compute sizes for the PR branch
- name: Build tinygo binary for the PR branch
run: go install
run: make tinygo ASSERT=1
- 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
- name: Checkout dev branch
id: dev
run: |
git reset --hard origin/dev
git checkout --no-recurse-submodules `git merge-base HEAD origin/dev`
git checkout --no-recurse-submodules "${{ github.event.pull_request.base.sha }}"
echo "llvm_version=$(cat llvm-version.txt)" >> "$GITHUB_OUTPUT"
- name: Install apt dependencies on the dev branch
# this is only needed on a PR that changes the LLVM version
run: ./.github/workflows/sizediff-install-pkgs.sh
- 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
- name: Build tinygo binary for the dev branch
run: go install
run: make tinygo ASSERT=1
- 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
# TODO: add a summary, something like:
Expand Down
Loading