Skip to content

MSVC CI Pipeline

MSVC CI Pipeline #17

Workflow file for this run

---
name: ci-windows
on:
push: { branches: [main, master] }
pull_request: { branches: [main, master] }
workflow_dispatch:
permissions: { contents: read }
concurrency:
group: ci-win-msys2-${{ github.ref }}
cancel-in-progress: true
jobs:
build-msys2:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
# Fast, cached packages: Clang toolchain + LLDB + CMake + Ninja + Python
- name: Setup MSYS2 (Clang64) + deps
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
update: true
install: >-
git
mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-lldb
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-ninja
mingw-w64-clang-x86_64-python
- name: Show LLDB (sanity)
run: |
ls -l /clang64/include/lldb/API/LLDB.h || true
ls -l /clang64/lib/liblldb* || true
ls -l /clang64/lib/cmake/lldb || true
# Configure
- name: Configure
env:
CC: clang
CXX: clang++
run: |
# Prefer CONFIG if present; otherwise fall back to the module hints.
if [ -f /clang64/lib/cmake/lldb/LLDBConfig.cmake ]; then
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=/clang64 \
-DLLDBG_USE_SYSTEM_DEPS=ON \
-DLLDBG_PREFER_CLANG=ON
else
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=/clang64 \
-DLLDBG_USE_SYSTEM_DEPS=ON \
-DLLDBG_PREFER_CLANG=ON \
-DLLDB_INCLUDE_DIR=/clang64/include \
-DLLDB_LIBRARY=/clang64/lib/liblldb.dll.a
fi
- name: Build
run: cmake --build build -j"$(nproc)"
- name: Test
env:
# Ensure liblldb.dll is on PATH for test-time loads
PATH: /clang64/bin:$PATH
run: ctest --test-dir build --output-on-failure
build-msvc:
name: MSVC + prebuilt LLVM/LLDB 21.1.3
runs-on: windows-latest
env:
LLVM_URL: "https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.3/clang+llvm-21.1.3-x86_64-pc-windows-msvc.tar.xz"
CMAKE_BUILD_PARALLEL_LEVEL: "4"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Put cl.exe (MSVC) on PATH
- uses: ilammy/msvc-dev-cmd@v1
- name: Install Ninja
run: choco install ninja -y
# Cache the extracted prebuilt LLVM tree so we don't redownload every run
- name: Cache prebuilt LLVM
id: cache-llvm
uses: actions/cache@v4
with:
path: ${{ runner.temp }}\clang-llvm-21.1.3-msvc
key: prebuilt-llvm21.1.3-${{ runner.os }}-msvc
- name: Download & extract LLVM (if cache miss)
if: steps.cache-llvm.outputs.cache-hit != 'true'
shell: pwsh
run: |
$dest = "$env:RUNNER_TEMP\clang-llvm-21.1.3-msvc"
New-Item -ItemType Directory -Force -Path $dest | Out-Null
$tar = "$env:RUNNER_TEMP\llvm21.tar.xz"
Write-Host "Downloading $env:LLVM_URL"
Invoke-WebRequest $env:LLVM_URL -OutFile $tar
# Extract .tar.xz (bsdtar on the runner handles xz)
tar -xf $tar -C $dest
- name: Locate LLVM/LLDB CMake packages
id: locate
shell: pwsh
run: |
$root = Get-ChildItem -Path "$env:RUNNER_TEMP\clang-llvm-21.1.3-msvc" -Directory | Select-Object -First 1
if (-not $root) { throw "LLVM archive not found/extracted." }
$llvmDir = Join-Path $root.FullName "lib\cmake\llvm"
$lldbDir = Join-Path $root.FullName "lib\cmake\lldb"
if (!(Test-Path $llvmDir)) { throw "Missing LLVM_DIR at $llvmDir" }
if (!(Test-Path $lldbDir)) { throw "Missing LLDB_DIR at $lldbDir" }
"root=$($root.FullName)" >> $env:GITHUB_OUTPUT
"LLVM_DIR=$llvmDir" >> $env:GITHUB_OUTPUT
"LLDB_DIR=$lldbDir" >> $env:GITHUB_OUTPUT
Write-Host "LLVM root: $($root.FullName)"
# Optional: make LLVM/LLDB tools available if any post-build step needs them
- name: Add LLVM bin to PATH
shell: pwsh
run: echo "${{ steps.locate.outputs.root }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure (MSVC + prebuilt LLVM/LLDB)
run: >
cmake -S . -B build-msvc -G "Ninja"
-DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
-DCMAKE_BUILD_TYPE=Release
-DLLVM_DIR="${{ steps.locate.outputs.LLVM_DIR }}"
-DLLDB_DIR="${{ steps.locate.outputs.LLDB_DIR }}"
-DLLDBG_ENABLE_LLDB=ON
- name: Build
run: cmake --build build-msvc --config Release -- -v