Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1ef22ae
chore: use umbrella targets for LLVM distribution components
16bit-ykiko Jun 6, 2026
93b5310
fix: reduce LLVM_TARGETS_TO_BUILD to X86;AArch64;ARM;RISCV
16bit-ykiko Jun 6, 2026
7f612d9
fix: free disk space on macOS runners before LLVM build
16bit-ykiko Jun 6, 2026
d734725
ci: add temporary workflow to test macOS disk cleanup
16bit-ykiko Jun 6, 2026
fc7e2bc
ci(temp): test macOS disk cleanup only
16bit-ykiko Jun 6, 2026
99c8b0e
ci: restore full build matrix and remove test workflow
16bit-ykiko Jun 6, 2026
c7e7462
chore: adapt codebase to LLVM 22.1.4 API changes
16bit-ykiko Jun 6, 2026
9e004a2
ci: add prune-llvm workflow for discovering unused LLVM libraries
16bit-ykiko Jun 6, 2026
be37e95
fix(prune): record file sizes during discover and fix skip-pattern
16bit-ykiko Jun 6, 2026
b5be360
refactor(cmake): switch to find_package(LLVM/Clang) for dependency re…
16bit-ykiko Jun 6, 2026
25a6e85
fix(prune): nullify shared libs and force relink during discovery
16bit-ykiko Jun 6, 2026
115fc4a
fix(prune): replace pruned libs with empty archives and track shared …
16bit-ykiko Jun 6, 2026
baffc35
ci: add release-llvm workflow and rewrite cmake download
16bit-ykiko Jun 6, 2026
42ae5f3
ci: add push trigger for release-llvm on feature branch
16bit-ykiko Jun 6, 2026
9d83938
refactor: rename prune script to release-llvm and add parallel repackage
16bit-ykiko Jun 6, 2026
8a1ff57
ci: split repackage into parallel matrix jobs with direct release upload
16bit-ykiko Jun 6, 2026
2701592
fix(release): use xz -6 compression to keep assets under 2GB limit
16bit-ykiko Jun 6, 2026
b6eaf21
fix(release): use xz -6 compression to keep assets under 2GB limit
16bit-ykiko Jun 6, 2026
a98c370
fix(release): retry with xz -9 when artifact exceeds 2GB limit
16bit-ykiko Jun 6, 2026
3e6e9c7
refactor(release): use xz -9 compression and key-based manifest format
16bit-ykiko Jun 7, 2026
3ccd229
refactor(release): use xz -9e extreme compression for maximum ratio
16bit-ykiko Jun 7, 2026
0bb19b6
chore: update llvm-manifest.json to 22.1.4
16bit-ykiko Jun 7, 2026
5a06cd0
chore: remove unused setup-llvm.py
16bit-ykiko Jun 8, 2026
c609dc8
fix: address review findings for LLVM 22 upgrade
16bit-ykiko Jun 9, 2026
4adaa1e
fix: address second round of review findings
16bit-ykiko Jun 9, 2026
ea07d04
chore: strip build-llvm.yml to LLVM-only build
16bit-ykiko Jun 9, 2026
4d82e38
fix: add clangOptions to link deps and apply formatting
16bit-ykiko Jun 9, 2026
a8720c9
chore: remove dead upload-llvm workflow and scripts
16bit-ykiko Jun 9, 2026
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
72 changes: 53 additions & 19 deletions .github/workflows/build-llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
required: false
type: boolean
default: false
skip_clice_build:
description: "Skip building and testing clice (LLVM-only build)"
required: false
type: boolean
default: false
pull_request:
# if you want to run this workflow, change the branch name to main,
# if you want to turn off it, change it to non existent branch.
Expand Down Expand Up @@ -121,20 +126,48 @@ jobs:
with:
environments: ${{ matrix.pixi_env || 'package' }}

- name: Free Disk Space (macOS)
if: runner.os == 'macOS'
run: |
echo "=== Before cleanup ==="
df -h /

# Remove iOS/tvOS/watchOS/visionOS simulators
if [ -d "/Library/Developer/CoreSimulator" ]; then
sudo rm -rf /Library/Developer/CoreSimulator
echo "Removed CoreSimulator"
fi

# Remove unnecessary Xcode platforms (keep macOS only)
XCODE_PATH="$(xcode-select -p)"
PLATFORMS_DIR="${XCODE_PATH}/Platforms"
for platform in iPhoneOS.platform iPhoneSimulator.platform AppleTVOS.platform AppleTVSimulator.platform WatchOS.platform WatchSimulator.platform XROS.platform XRSimulator.platform; do
if [ -d "${PLATFORMS_DIR}/${platform}" ]; then
sudo rm -rf "${PLATFORMS_DIR}/${platform}"
echo "Removed ${platform}"
fi
done

# Remove Android SDK
sudo rm -rf ~/Library/Android

# Remove .NET/PowerShell
sudo rm -rf /usr/local/share/dotnet
sudo rm -rf /usr/local/share/powershell

# Remove Haskell
sudo rm -rf ~/.ghcup

echo "=== After cleanup ==="
df -h /

- name: Clone llvm-project
shell: bash
run: |
VERSION="${{ inputs.llvm_version || '21.1.8' }}"
echo "Cloning LLVM ${VERSION}..."
git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm
Comment on lines 145 to 150

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Template injection vulnerability from user-controlled input.

Direct interpolation of ${{ inputs.llvm_version }} into the shell script enables code injection if a malicious value is provided. While the attack surface is limited to users with workflow dispatch permissions, defense-in-depth recommends using the env context instead.

🔒 Recommended fix: pass input via env context
       - name: Clone llvm-project
         shell: bash
+        env:
+          LLVM_VERSION: ${{ inputs.llvm_version }}
         run: |
-          VERSION="${{ inputs.llvm_version }}"
+          VERSION="${LLVM_VERSION}"
           echo "Cloning LLVM ${VERSION}..."
           git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm
🧰 Tools
🪛 zizmor (1.25.2)

[error] 148-148: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build-llvm.yml around lines 145 - 150, The workflow step
"Clone llvm-project" currently interpolates the user input directly into the run
script via `${{ inputs.llvm_version }}`, which allows template injection;
instead pass the input through the step's env context (set an env key like
VERSION: ${{ inputs.llvm_version }}) and then reference the safe shell variable
(`$VERSION`) inside the run script used by that step (keep the step name "Clone
llvm-project" and the shell variable `VERSION` so you can find it). Ensure the
run script uses the env variable (quoted) when printing and when supplying the
git --branch argument to avoid direct template interpolation.

Source: Linters/SAST tools


- name: Validate distribution components
shell: bash
run: |
python3 scripts/validate-llvm-components.py \
--llvm-src=.llvm \
--components-file=scripts/llvm-components.json

- name: Build LLVM (install-distribution)
shell: bash
run: |
Expand All @@ -151,7 +184,7 @@ jobs:
${EXTRA_ARGS}

- name: Build clice using installed LLVM
if: ${{ !matrix.target_triple }}
if: ${{ !matrix.target_triple && !inputs.skip_clice_build }}
shell: bash
run: |
pixi run cmake-config ${{ matrix.llvm_mode }} ON -- \
Expand All @@ -160,7 +193,7 @@ jobs:
pixi run cmake-build ${{ matrix.llvm_mode }}

- name: Build clice using installed LLVM (cross-compile)
if: ${{ matrix.target_triple }}
if: ${{ matrix.target_triple && !inputs.skip_clice_build }}
shell: bash
run: |
ENV="${{ matrix.pixi_env || 'package' }}"
Expand All @@ -171,7 +204,7 @@ jobs:
pixi run -e "$ENV" cmake-build ${{ matrix.llvm_mode }}

- name: Verify cross-compiled binary architecture
if: ${{ matrix.target_triple && runner.os != 'Windows' }}
if: ${{ matrix.target_triple && runner.os != 'Windows' && !inputs.skip_clice_build }}
shell: bash
run: |
BINARY="build/${{ matrix.llvm_mode }}/bin/clice"
Expand All @@ -183,7 +216,7 @@ jobs:
esac

- name: Upload cross-compiled clice for functional test
if: ${{ matrix.target_triple && matrix.lto == 'OFF' }}
if: ${{ matrix.target_triple && matrix.lto == 'OFF' && !inputs.skip_clice_build }}
uses: actions/upload-artifact@v4
with:
name: cross-clice-${{ matrix.target_triple }}-${{ matrix.llvm_mode }}
Expand All @@ -194,19 +227,19 @@ jobs:
retention-days: 1

- name: Run tests
if: ${{ !matrix.target_triple }}
if: ${{ !matrix.target_triple && !inputs.skip_clice_build }}
shell: bash
run: pixi run test ${{ matrix.llvm_mode }}

# Prune is only supported for native builds (requires linking clice to test).
# Cross-compiled targets reuse the native prune manifest of the same OS.
- name: Prune LLVM static libraries (Debug/RelWithDebInfo no LTO)
if: (!matrix.target_triple) && (matrix.llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'))
if: (!inputs.skip_clice_build) && (!matrix.target_triple) && (matrix.llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'))
shell: bash
run: |
MANIFEST="pruned-libs-${{ matrix.os }}.json"
echo "LLVM_PRUNED_MANIFEST=${MANIFEST}" >> "${GITHUB_ENV}"
python3 scripts/prune-llvm-bin.py \
python3 scripts/release-llvm.py \
--action discover \
--install-dir ".llvm/build-install/lib" \
--build-dir "build/${{ matrix.llvm_mode }}" \
Expand All @@ -215,7 +248,7 @@ jobs:
--manifest "${MANIFEST}"

- name: Upload pruned-libs manifest
if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'
if: (!inputs.skip_clice_build) && (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'
uses: actions/upload-artifact@v4
with:
name: llvm-pruned-libs-${{ matrix.os }}
Expand All @@ -224,13 +257,13 @@ jobs:
compression-level: 0

- name: Apply pruned-libs manifest (RelWithDebInfo + LTO, native only)
if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON'
if: (!inputs.skip_clice_build) && (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
MANIFEST="pruned-libs-${{ matrix.os }}.json"
python3 scripts/prune-llvm-bin.py \
python3 scripts/release-llvm.py \
--action apply \
--manifest "${MANIFEST}" \
--install-dir ".llvm/build-install/lib" \
Expand All @@ -244,13 +277,13 @@ jobs:
# For cross-compiled LTO builds, apply the native prune manifest.
# The unused library set is arch-independent (same API surface).
- name: Apply pruned-libs manifest (cross-compile + LTO)
if: matrix.target_triple && matrix.lto == 'ON'
if: (!inputs.skip_clice_build) && matrix.target_triple && matrix.lto == 'ON'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
MANIFEST="pruned-libs-${{ matrix.os }}.json"
python3 scripts/prune-llvm-bin.py \
python3 scripts/release-llvm.py \
--action apply \
--manifest "${MANIFEST}" \
--install-dir ".llvm/build-install/lib" \
Expand Down Expand Up @@ -316,6 +349,7 @@ jobs:

test-cross:
needs: build
if: ${{ !inputs.skip_clice_build }}
strategy:
fail-fast: false
matrix:
Expand Down
Loading
Loading