Skip to content

🔙 Bring back Debug builds for Windows and more#30

Draft
burgholzer wants to merge 93 commits intomainfrom
reenable-debug-builds-on-windows
Draft

🔙 Bring back Debug builds for Windows and more#30
burgholzer wants to merge 93 commits intomainfrom
reenable-debug-builds-on-windows

Conversation

@burgholzer
Copy link
Member

This reverts commit 867ad10.
MQT Core Windows Debug tests won't compile when mixing Release MLIR builds with Debug MQT Core builds.
We have to make this work somehow.

@burgholzer burgholzer self-assigned this Mar 1, 2026
@burgholzer burgholzer added fix Fixes something that is not working minor Changes warranting a minor version bump labels Mar 1, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Tests

    • Added end-to-end installation tests for MLIR toolchains on Windows, Linux, and macOS (Release and Debug).
  • New Features

    • Automated test-installation workflows that validate packaged archives by building and running an integration example.
    • Shared logging helpers for scripted build/test steps.
  • Chores

    • Split Windows CI into reusable runner workflows for separate targets and build types; modularized Windows build and packaging.
    • Switched Linux/macOS builds to Ninja, improved step logging, packaging, and artifact handling.
    • Updated copyright years to 2025–2026.

Walkthrough

Replaces the Windows matrix job with two reusable-workflow invocations and a dedicated Windows runner; splits Windows build into modular scripts; adds platform test-installation scripts, shared logging helpers, Ninja-based builds, packaging, and a minimal MLIR integration test; updates changelog and license years. (50 words)

Changes

Cohort / File(s) Summary
Windows workflow entrypoints
​.github/workflows/build-mlir-windows.yml
Replaced matrix-based single job with two public jobs (windows-2025, windows-11-arm) that call the new reusable windows runner workflow and forward inputs.
Windows runner & CI jobs
​.github/workflows/build-mlir-windows-runner.yml
New reusable workflow implementing multi-job Windows pipeline (build-zstd, build-lld, build-mlir Release/Debug, packaging, test jobs) with artifact upload/download orchestration.
Windows modular scripts
scripts/toolchain/windows/build.ps1, scripts/toolchain/windows/build-zstd.ps1, scripts/toolchain/windows/build-lld.ps1, scripts/toolchain/windows/build-mlir.ps1, scripts/toolchain/windows/package-mlir.ps1, scripts/toolchain/windows/test-installation.ps1
Split monolithic Windows build into focused scripts; added build_type parameter, robust path handling, modular build steps, packaging, testing, structured logging and cleanup.
Windows helpers
scripts/toolchain/windows/common.ps1
New shared PowerShell helpers: Invoke-Checked, path utilities, arch detection, VS dev shell entry, Ensure-Ninja, LLVM source bootstrap, and CMake arg builder used by Windows scripts.
Linux build & container
scripts/toolchain/linux/in-container.sh, scripts/toolchain/linux/build.sh, scripts/toolchain/linux/test-installation.sh
Introduce Ninja provisioning, step logging, staged build (zstd → lld → MLIR), zstd bundling into install, symbol stripping, tar.zst packaging, and a test-installation script that extracts archives and runs integration tests.
macOS build & test
scripts/toolchain/macos/build.sh, scripts/toolchain/macos/test-installation.sh
Add Ninja setup, log_step/log_done helpers, build_zstd/build_llvm functions, zstd bundling, packaging, and a macOS test-installation script validating archives and running integration tests.
Shared Bash utilities
scripts/toolchain/common.sh
Added log_step() and log_done() for consistent step timing/logging across Linux/macOS scripts.
Integration tests
tests/integration/CMakeLists.txt, tests/integration/main.cpp
Add minimal MLIR integration test (hello_mlir) and C++ test program to exercise installed toolchain.
CI test jobs
​.github/workflows/build-mlir-linux.yml, ​.github/workflows/build-mlir-macos.yml
Add test jobs that download platform artifacts, extract zstd, and run platform-specific test-installation scripts post-build.
Metadata & changelog
CHANGELOG.md, .license-tools-config.json
Update Unreleased date/links and remove a subsection/PR link; update license author years from 2025 to 2025 - 2026.

Sequence Diagram(s)

sequenceDiagram
  actor Dev
  participant GH as "GitHub Actions"
  participant Entry as "build-mlir-windows.yml"
  participant Runner as "build-mlir-windows-runner.yml"
  participant ZSTD as "build-zstd.ps1"
  participant LLD as "build-lld.ps1"
  participant MLIR as "build-mlir.ps1"
  participant Package as "package-mlir.ps1"
  participant Test as "test-installation.ps1"
  participant Artifacts as "GitHub Artifacts"

  Dev->>GH: push / open PR
  GH->>Entry: trigger windows workflow
  Entry->>Runner: invoke reusable runner (llvm-project-ref, runs-on)
  Runner->>ZSTD: run build-zstd (checkout, build, upload)
  ZSTD->>Artifacts: upload zstd artifact
  Runner->>LLD: run build-lld (download zstd, build lld, upload)
  LLD->>Artifacts: upload lld artifact
  Runner->>MLIR: run build-mlir (download zstd/lld, build Release/Debug)
  MLIR->>Package: package archive with zstd
  Package->>Artifacts: upload llvm-mlir_*.tar.zst
  Runner->>Test: run test-release/debug (download artifacts, extract, test)
  Test->>Artifacts: read artifacts, extract, build/run integration test
  Test->>Runner: report success/failure
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

feature

Poem

🐰
I hop through scripts with tiny feet and cheer,
Splitting builds like carrots, neat and clear.
Zstd snugged in bundles, tests leap into sight,
Across three hosts the CI hums tonight,
A rabbit's grin for builds that pass in flight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly indicates the main change: re-enabling Debug builds for Windows, which aligns with reverting a previous commit and adding infrastructure for Debug build support.
Description check ✅ Passed The description accurately explains the purpose of the PR: reverting a previous commit to re-enable Debug builds on Windows to resolve compilation issues with Debug MQT Core tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch reenable-debug-builds-on-windows

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/toolchain/windows/build.ps1`:
- Line 173: Replace the positional Join-Path calls with named parameters to
improve readability: update both Join-Path invocations used in the $env:PATH
assignment (the outer Join-Path that uses $repo_dir and the inner one that uses
$build_dir and $build_type) to use -Path and -ChildPath (or nested Join-Path
with -Path/-ChildPath) and keep the same resulting strings that include "bin"
and $build_type so the environment PATH concatenation remains identical.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9dd6238 and 61cfd86.

📒 Files selected for processing (4)
  • .github/workflows/build-mlir-windows.yml
  • .github/workflows/build-portable-mlir-toolchain.yml
  • CHANGELOG.md
  • scripts/toolchain/windows/build.ps1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/toolchain/windows/build.ps1`:
- Around line 29-30: Update the usage/output comment that currently reads
"Creates zstd-<zstd_version>_windows_<arch>_<host_target>[_debug].zip" to match
actual behavior: either remove the "[_debug]" suffix from that zstd archive
description or explicitly state that zstd packaging is skipped for Debug builds;
then adjust the corresponding code comment near the Debug-branch that skips zstd
packaging (the block that omits zstd packaging for Debug builds) so both the
top-level output doc and the Debug-branch comments consistently reflect that
zstd archives are not produced for Debug builds.
- Around line 169-173: The CMake policy flag in the debug branch is using the
wrong cache variable name; update the argument added to $cmake_args from
'-DCMAKE_POLICY_CMP0141=NEW' to the correct cache variable
'-DCMAKE_POLICY_DEFAULT_CMP0141=NEW' so the policy default is actually applied
(change the entry in the block that appends to $cmake_args in the debug branch).

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61cfd86 and d071557.

📒 Files selected for processing (4)
  • .github/workflows/build-mlir-windows.yml
  • scripts/toolchain/linux/in-container.sh
  • scripts/toolchain/macos/build.sh
  • scripts/toolchain/windows/build.ps1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
scripts/toolchain/windows/build.ps1 (1)

29-30: ⚠️ Potential issue | 🟡 Minor

Output docs still claim a Debug zstd archive that is never produced.

Line 30 advertises [_debug] for the zstd zip, but Lines 234-239 explicitly skip zstd packaging in Debug mode.

📝 Proposed doc fix
-#   - Creates zstd-<zstd_version>_windows_<arch>_<host_target>[_debug].zip in the current directory
+#   - Creates zstd-<zstd_version>_windows_<arch>_<host_target>.zip in the current directory (Release builds only)

Also applies to: 234-239

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/toolchain/windows/build.ps1` around lines 29 - 30, The header output
comment incorrectly advertises a debug zstd archive
("zstd-<zstd_version>_windows_<arch>_<host_target>[_debug].zip") while the
script's Debug-mode conditional explicitly skips zstd packaging; fix by making
them consistent: either remove the "[_debug]" suffix from the header comment
that lists zstd output, or change the Debug-mode conditional that skips zstd
packaging so it produces the debug zstd archive; specifically update the output
docs line containing
"zstd-<zstd_version>_windows_<arch>_<host_target>[_debug].zip" or adjust the
zstd-packaging conditional that currently bypasses zstd creation in Debug mode.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/build-mlir-windows.yml:
- Around line 119-121: The removal of temp directories via Remove-IfExists
("C:\Windows\Temp", $env:TEMP, $env:LOCALAPPDATA\Temp) can break later steps;
after each Remove-IfExists call (or once after all removals) ensure the
directories are recreated and writable by calling the appropriate
create/ensure-directory routine (e.g., use New-Item -ItemType Directory or an
Ensure-Directory helper) for "C:\Windows\Temp", $env:TEMP and
$env:LOCALAPPDATA\Temp so subsequent actions have valid temp paths; keep the
recreate step immediately after the Remove-IfExists invocations and preserve
correct permissions/ownership.

---

Duplicate comments:
In `@scripts/toolchain/windows/build.ps1`:
- Around line 29-30: The header output comment incorrectly advertises a debug
zstd archive ("zstd-<zstd_version>_windows_<arch>_<host_target>[_debug].zip")
while the script's Debug-mode conditional explicitly skips zstd packaging; fix
by making them consistent: either remove the "[_debug]" suffix from the header
comment that lists zstd output, or change the Debug-mode conditional that skips
zstd packaging so it produces the debug zstd archive; specifically update the
output docs line containing
"zstd-<zstd_version>_windows_<arch>_<host_target>[_debug].zip" or adjust the
zstd-packaging conditional that currently bypasses zstd creation in Debug mode.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d071557 and 2943735.

📒 Files selected for processing (4)
  • .github/workflows/build-mlir-windows.yml
  • scripts/toolchain/linux/in-container.sh
  • scripts/toolchain/macos/build.sh
  • scripts/toolchain/windows/build.ps1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
scripts/toolchain/windows/build.ps1 (1)

29-30: ⚠️ Potential issue | 🟡 Minor

Documentation inconsistency for zstd archive in Debug builds.

Line 30 states the zstd archive is created with an optional _debug suffix, but lines 234-239 skip zstd packaging entirely for Debug builds. The documentation should clarify that zstd archives are only produced for Release builds.

📝 Proposed documentation fix
 # Outputs:
 #   - Installs into <install_prefix>
 #   - Creates llvm-mlir_<llvm_project_ref>_windows_<arch>_<host_target>[_debug].tar.zst in the current directory
-#   - Creates zstd-<zstd_version>_windows_<arch>_<host_target>.zip in the current directory (for Release builds)
+#   - Creates zstd-<zstd_version>_windows_<arch>_<host_target>.zip in the current directory (Release builds only)

This is a duplicate concern from a past review but the original issue was about the [_debug] suffix in the zstd description which has now been partially addressed by adding "(for Release builds)" but remains slightly misleading.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/toolchain/windows/build.ps1` around lines 29 - 30, Update the header
comment that describes the output artifacts so it no longer suggests a zstd
archive may include an optional "_debug" suffix; explicitly state that
zstd-<zstd_version>_windows_<arch>_<host_target>.zip is only produced for
Release builds (matching the packaging logic that skips zstd for Debug), and
remove or correct the "[_debug]" mention in the zstd line so the header
accurately reflects the behavior implemented later in the script.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/build-mlir-windows.yml:
- Around line 152-155: The conditional in the upload step's path uses `${{
inputs.build-type == 'Release' && 'zstd-*.zip' || '' }}` which can produce an
empty string and makes `path` empty for non-Release builds; fix by either (A)
moving the entire upload step behind `if: ${{ inputs.build-type == 'Release' }}`
so the step only runs for Release builds (keep name and uses:
actions/upload-artifact@... and list both patterns `llvm-mlir_*.tar.zst` and
`zstd-*.zip` in path), or (B) keep the step always present but ensure `path` is
never empty by replacing the false branch with a non-existent placeholder (e.g.
`'__no_such_path__'`) and add `if-no-files-found: ignore` to the upload-artifact
step so it won’t fail when no files match; update the `path` and
`if-no-files-found` settings accordingly.

In `@scripts/toolchain/linux/in-container.sh`:
- Around line 193-199: The conditional copy that checks [[ -d
"$ZSTD_INSTALL_PREFIX/lib/cmake" ]] and then cp -r
"$ZSTD_INSTALL_PREFIX/lib/cmake/." "$INSTALL_PREFIX/lib/cmake/" is redundant
because the preceding cp -r "$ZSTD_INSTALL_PREFIX/lib/." "$INSTALL_PREFIX/lib/"
already copies lib/cmake; remove that conditional block to avoid duplicate work,
or if you intended to handle an alternate cmake location, replace it with a
clarifying comment explaining the special case and why an extra copy is required
(referencing the variables $ZSTD_INSTALL_PREFIX and $INSTALL_PREFIX and the cp
-r operations).

---

Duplicate comments:
In `@scripts/toolchain/windows/build.ps1`:
- Around line 29-30: Update the header comment that describes the output
artifacts so it no longer suggests a zstd archive may include an optional
"_debug" suffix; explicitly state that
zstd-<zstd_version>_windows_<arch>_<host_target>.zip is only produced for
Release builds (matching the packaging logic that skips zstd for Debug), and
remove or correct the "[_debug]" mention in the zstd line so the header
accurately reflects the behavior implemented later in the script.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2943735 and 7ffc302.

📒 Files selected for processing (3)
  • .github/workflows/build-mlir-windows.yml
  • scripts/toolchain/linux/in-container.sh
  • scripts/toolchain/windows/build.ps1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/build-mlir-linux.yml:
- Around line 75-78: Replace the fragile use of ls when setting archive with a
robust find command: change the archive assignment (the line setting
archive=$(ls llvm-mlir_*.tar.zst | head -1)) to use find to locate the first
matching file (e.g. use find . -maxdepth 1 -type f -name 'llvm-mlir_*.tar.zst'
-print -quit and assign its basename or path to archive) so the subsequent bash
call that passes "${{ github.workspace }}/$archive" uses a reliably discovered
filename; ensure you preserve the existing behavior of choosing the first match
and handle the case where find returns nothing (fail the job or error out) in
the same location where archive is used.
- Around line 64-67: Replace the loose tag actions/download-artifact@v4 with the
repository commit SHA used elsewhere in this workflow (matching the pinning
pattern), e.g. actions/download-artifact@<SHA> # v4; locate the step named
"Download archive" and update the uses value to the SHA-pinned ref so it follows
the same pinning style as actions/checkout and actions/upload-artifact.

In @.github/workflows/build-mlir-macos.yml:
- Around line 46-49: Update the "Download archive" step that currently uses
actions/download-artifact@v4 to pin it to a specific commit SHA for security and
reproducibility; replace the version tag in the uses field
(actions/download-artifact@v4) with the repository@<commit-sha> form (the exact
SHA from the Linux workflow) so the "Download archive" step uses
actions/download-artifact@<sha>.
- Around line 57-60: Replace the fragile ls-based archive discovery assigned to
the archive variable with a find-based lookup to handle special characters: use
find to search for files matching the pattern llvm-mlir_*.tar.zst (e.g.,
starting from the workspace directory or current directory), limit to a single
result (first match) and assign that path to the archive variable, then pass
"${{ github.workspace }}/$archive" to the test-installation.sh invocation
unchanged; update the line that sets archive and keep the subsequent bash call
to test-installation.sh using the -a and -z flags as before.

In @.github/workflows/build-mlir-windows.yml:
- Around line 168-171: The workflow step named "Download archive" currently uses
actions/download-artifact@v4; replace that tag with a specific commit SHA to
match the other pinned actions (i.e., change uses: actions/download-artifact@v4
to uses: actions/download-artifact@<commit-sha>) so the step is pinned for
supply-chain security; locate the appropriate commit SHA for the
actions/download-artifact repository (matching the v4 release you expect) and
update the uses line in that "Download archive" step.

In `@tests/integration/main.cpp`:
- Around line 24-38: ModuleOp created with mlir::ModuleOp::create is an owning
operation that should be explicitly erased before the mlir::MLIRContext is
destroyed; update main to destroy/erase the module operation (call the
appropriate erase/destroy method on the mlir::ModuleOp instance returned by
ModuleOp::create, e.g. module.erase() or module->destroy(), before returning) so
the module is cleaned up explicitly instead of relying on implicit context
teardown.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ffc302 and 030bc3a.

📒 Files selected for processing (13)
  • .github/workflows/build-mlir-linux.yml
  • .github/workflows/build-mlir-macos.yml
  • .github/workflows/build-mlir-windows.yml
  • .license-tools-config.json
  • scripts/toolchain/linux/build.sh
  • scripts/toolchain/linux/in-container.sh
  • scripts/toolchain/linux/test-installation.sh
  • scripts/toolchain/macos/build.sh
  • scripts/toolchain/macos/test-installation.sh
  • scripts/toolchain/windows/build.ps1
  • scripts/toolchain/windows/test-installation.ps1
  • tests/integration/CMakeLists.txt
  • tests/integration/main.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fixes something that is not working minor Changes warranting a minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant