Repository navigation
build: modernize LLVM build and release workflow #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f4719a7
build: modernize LLVM build and release workflow
16bit-ykiko 0a44c74
fix: remove LLVM 22-only libs from link deps for 21.1.8 compat
16bit-ykiko 39b8dd1
build: update manifest to 21.1.8+r1 and remove temp push trigger
16bit-ykiko 1129869
fix: address review findings for build infra PR
16bit-ykiko 43d49e8
ci: upgrade actions to match main (checkout@v7, upload@v7, download@v8)
16bit-ykiko 873ef2d
docs: remove stale skip flag note from upgrade-llvm skill
16bit-ykiko 5595d49
refactor: simplify build infrastructure and normalize manifest
16bit-ykiko bcc33d7
build: update manifest from release-llvm with flat array format
16bit-ykiko 0d5ad4c
ci: always update release notes with latest build run link
16bit-ykiko cee125e
fix: address review findings for build infra PR
16bit-ykiko 3523188
fix: address review findings for build infra PR
16bit-ykiko 57a1b77
build: flatten LLVM archive layout and remove workarounds
16bit-ykiko c92dca1
build: unify artifact names to arm64, add concurrency groups
16bit-ykiko f1b8157
ci: retrigger build-llvm after cancellation
16bit-ykiko bee11ce
ci: remove temp push trigger from build-llvm
16bit-ykiko 38d1b94
fix: update discover paths for flattened LLVM archive layout
16bit-ykiko 92a3859
build: update manifest from release-llvm with arm64 naming and flat l…
16bit-ykiko 74d69b6
fix: address review findings for build infra PR
16bit-ykiko db55ea7
refactor: remove llvm-manifest.json, compute artifact URL directly
16bit-ykiko 0e752a8
fix: remove dead apply subcommand, reject unknown CPU arch
16bit-ykiko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| Upgrade LLVM to a new version. Accepts the target version as argument (e.g., `22.1.4`). | ||
|
|
||
| This is the complete workflow for upgrading the LLVM prebuilt packages that clice depends on. Follow each step in order. Steps that involve CI should use polling (check every ~5 minutes) to wait for completion. | ||
|
|
||
| ## Step 1: Trigger LLVM Build | ||
|
|
||
| Trigger the `build-llvm` workflow on GitHub Actions: | ||
|
|
||
| ```bash | ||
| gh workflow run build-llvm.yml \ | ||
| --field llvm_version="<VERSION>" | ||
| ``` | ||
|
|
||
| - Poll until all 14 matrix builds complete (~2-3 hours), note the workflow run ID | ||
|
|
||
| ## Step 2: Download Local Platform Artifact | ||
|
|
||
| Download the artifact matching the development machine: | ||
|
|
||
| ```bash | ||
| gh run view <RUN_ID> | ||
| gh run download <RUN_ID> -n x64-linux-gnu-releasedbg.tar.xz -D .llvm-download | ||
| mkdir -p .llvm | ||
| tar -xf .llvm-download/x64-linux-gnu-releasedbg.tar.xz -C .llvm | ||
| ``` | ||
|
|
||
| Configure clice to build against it: | ||
|
|
||
| ```bash | ||
| pixi run cmake-config RelWithDebInfo ON -- "-DLLVM_INSTALL_PATH=.llvm" | ||
| pixi run cmake-build RelWithDebInfo | ||
| ``` | ||
|
|
||
| Compilation will likely fail — that's what Step 3 addresses. | ||
|
|
||
| ## Step 3: Adapt API Changes | ||
|
|
||
| Fix LLVM API breaking changes based on compilation errors. Common categories: | ||
|
|
||
| - **Header path changes**: e.g., `clang/Driver/Options.h` → `clang/Options/Options.h` | ||
| - **Namespace migrations**: e.g., `clang::driver::options` → `clang::options` | ||
| - **Type system changes**: e.g., ElaboratedType removal, NestedNameSpecifier pointer→value | ||
| - **Function signature changes**: e.g., `createDiagnostics` parameter changes | ||
| - **Type merges/splits**: e.g., DependentTemplateSpecializationType → TemplateSpecializationType | ||
|
|
||
| Strategy: | ||
|
|
||
| 1. Fix header/namespace changes first (mechanical) | ||
| 2. Fix type system and signature changes (requires understanding semantics) | ||
| 3. Update test expectations (AST structure changes affect test output) | ||
| 4. Ensure `pixi run unit-test RelWithDebInfo` passes | ||
|
|
||
| When a fix is not obvious, read the LLVM source code to understand the new API. If `../llvm-project` exists locally, use it. Otherwise, look up the upstream commit/PR on GitHub. | ||
|
|
||
| ## Step 4: Create PR | ||
|
|
||
| ```bash | ||
| git checkout -b chore/upgrade-llvm-XX | ||
| git add -A | ||
| git commit -m "chore: upgrade LLVM to XX.Y.Z" | ||
| git push -u origin chore/upgrade-llvm-XX | ||
| gh pr create --title "chore: upgrade LLVM to XX.Y.Z" --body "..." | ||
| ``` | ||
|
|
||
| CI will fail at this point (manifest hashes are stale) — this is expected. | ||
|
|
||
| ## Step 5: Run Release LLVM Workflow | ||
|
|
||
| Trigger `release-llvm` to build pruned packages: | ||
|
|
||
| ```bash | ||
| gh workflow run release-llvm.yml \ | ||
| --ref <BRANCH> \ | ||
| --field source_run_id="<STEP1_RUN_ID>" \ | ||
| --field llvm_version="<VERSION>" | ||
| ``` | ||
|
|
||
| This will: discover unused libs → create clice-llvm release → repackage with pruning. Poll until complete. | ||
|
|
||
| ## Step 6: Update Version | ||
|
|
||
| Update the version string in `cmake/package.cmake`: | ||
|
|
||
| ``` | ||
| setup_llvm("<VERSION>") | ||
| ``` | ||
|
|
||
| Commit and push: | ||
|
|
||
| ```bash | ||
| git add cmake/package.cmake | ||
| git commit -m "chore: update LLVM to <VERSION>" | ||
| git push | ||
| ``` | ||
|
|
||
| Poll CI until all platforms pass. CMake downloads the correct artifact automatically based on the version and platform — no manifest file needed. | ||
|
|
||
| ## Step 7: Write LLVM Changelog (REQUIRED) | ||
|
|
||
| **Every LLVM upgrade MUST append to `docs/en/changelog/llvm-changelog.md`.** | ||
|
|
||
| Add a new H2 section (e.g., `## LLVM 22 → 23`) documenting all breaking changes encountered. For each API change, record: | ||
|
|
||
| - Change description | ||
| - Upstream commit hash | ||
| - PR number (link to `https://github.com/llvm/llvm-project/pull/<NUM>`) | ||
| - Impact on clice | ||
|
|
||
| To find upstream commits, search the LLVM git history between version tags: | ||
|
|
||
| ```bash | ||
| # If ../llvm-project exists locally: | ||
| cd ../llvm-project | ||
| git log --oneline llvmorg-<OLD>..llvmorg-<NEW> -- clang/include/clang/AST/ | ||
| ``` | ||
|
|
||
| If the LLVM source is not available locally, look up changes on GitHub by searching the LLVM repository commit history. | ||
|
|
||
| Group changes by category (Type System, NNS, Driver/Frontend, Other) with a table per category. See the existing `LLVM 21 → 22` section as a template. | ||
|
|
||
| ## Step 8: Report to User | ||
|
|
||
| Present a summary to the user and **wait for confirmation** before considering the upgrade complete. The summary should include: | ||
|
|
||
| - All API changes that were adapted and how they were resolved | ||
| - All test expectation changes (snapshot updates, assertion value changes) and why | ||
| - Any unavoidable behavior changes from upstream LLVM (e.g., TypePrinter output differences, type sugar changes) that affect user-visible features like hover | ||
| - The LLVM changelog that was written | ||
|
|
||
| The user decides whether all changes are acceptable or if adjustments are needed. Do NOT push final changes or mark the work as done until the user confirms. | ||
|
|
||
| ## Notes | ||
|
|
||
| - **Artifact size limit**: GitHub Release max 2GB per file. macOS LTO artifacts are largest, currently ~1.7GB with xz -9e. | ||
| - **Pruning safety**: discover phase validates by deleting .a files one by one and rebuilding clice. clang-tidy modules can't be deleted due to force-link. | ||
| - **Private headers**: clice depends on private Clang Sema headers (TreeTransform.h etc.), copied from source during `build-llvm.py`. Users must use our packaged LLVM. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.