mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-10 14:39:31 +00:00
ci: share LLVM setup steps
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
name: Set up LLVM
|
||||||
|
description: Restore or build LLVM with assertions enabled
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
save-cache:
|
||||||
|
description: Save LLVM caches after a cache miss
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Restore LLVM source cache
|
||||||
|
uses: actions/cache/restore@v5
|
||||||
|
id: cache-llvm-source
|
||||||
|
with:
|
||||||
|
key: llvm-source-22-linux-ubuntu-24.04-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'
|
||||||
|
shell: bash
|
||||||
|
run: make llvm-source
|
||||||
|
- name: Save LLVM source cache
|
||||||
|
uses: actions/cache/save@v5
|
||||||
|
if: inputs.save-cache == 'true' && 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-ubuntu-24.04-asserts-v1-${{ hashFiles('llvm-version.txt') }}
|
||||||
|
path: llvm-build
|
||||||
|
- name: Install Ninja
|
||||||
|
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install --no-install-recommends ninja-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=1
|
||||||
|
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
|
||||||
|
- name: Save LLVM build cache
|
||||||
|
uses: actions/cache/save@v5
|
||||||
|
if: inputs.save-cache == 'true' && steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
|
||||||
|
path: llvm-build
|
||||||
@@ -220,7 +220,7 @@ jobs:
|
|||||||
assert-test-linux:
|
assert-test-linux:
|
||||||
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
|
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
|
||||||
# potential bugs.
|
# potential bugs.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -239,8 +239,7 @@ jobs:
|
|||||||
qemu-system-arm \
|
qemu-system-arm \
|
||||||
qemu-system-riscv32 \
|
qemu-system-riscv32 \
|
||||||
qemu-user \
|
qemu-user \
|
||||||
simavr \
|
simavr
|
||||||
ninja-build
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
@@ -264,53 +263,7 @@ jobs:
|
|||||||
"https://github.com/espressif/qemu/releases/download/$release/$archive"
|
"https://github.com/espressif/qemu/releases/download/$release/$archive"
|
||||||
tar -xJf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP"
|
tar -xJf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP"
|
||||||
echo "$RUNNER_TEMP/qemu/bin" >> "$GITHUB_PATH"
|
echo "$RUNNER_TEMP/qemu/bin" >> "$GITHUB_PATH"
|
||||||
- name: Restore LLVM source cache
|
- uses: ./.github/actions/setup-llvm
|
||||||
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
|
|
||||||
- name: Cache Binaryen
|
- name: Cache Binaryen
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
id: cache-binaryen
|
id: cache-binaryen
|
||||||
|
|||||||
Reference in New Issue
Block a user