Skip to content

Add Windows CI jobs #28

Add Windows CI jobs

Add Windows CI jobs #28

name: windows-msvc-ci
on:
push:
tags:
- 'v*'
pull_request:
branches: [ main ]
env:
R2_REPO: https://github.com/radareorg/radare2
R2_TAG: ''
R2V: 6.0.4
jobs:
build-msvc:
name: Build (MSVC / cl)
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python and Meson
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install meson
- name: Download radare2 release (zip)
shell: pwsh
run: |
$R2V = '${{ env.R2V }}'
$tmp = "$env:TEMP\radare2.zip"
$candidates = @(
"radare2-$R2V-w64.zip",
"radare2-$R2V-windows-x64.zip",
"radare2-$R2V-windows.zip"
)
$found = $false
foreach ($n in $candidates) {
$url = "https://github.com/radareorg/radare2/releases/download/$R2V/$n"
Write-Host "Trying $url"
try { Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing; $found = $true; break } catch { Write-Host "Not found: $n" }
}
if (-not $found) { Write-Error "No radare2 release zip found for $R2V"; exit 1 }
$dest = 'C:\radare2'
New-Item -ItemType Directory -Force -Path $dest | Out-Null
Expand-Archive -Path $tmp -DestinationPath $dest -Force
Write-Host "Extracted radare2 to $dest"
- name: Show radare2 candidate include/lib dirs (MSVC job)
shell: pwsh
run: |
$prefix = 'C:\\radare2'
$posix = $prefix -replace '\\','/'
Write-Host "Normalized r2_prefix (posix): $posix"
$candidates = @(
Join-Path $prefix 'include',
Join-Path $prefix 'include\libr',
Join-Path $prefix 'radare2\include',
Join-Path $prefix 'lib',
Join-Path $prefix 'radare2\lib',
Join-Path $prefix 'bin'
)
foreach ($d in $candidates) {
if (Test-Path $d) {
Write-Host "Contents of ${d}:"
Get-ChildItem -Path $d -Recurse -Depth 1 | Select-Object FullName, Mode, Length | Format-Table -AutoSize
} else {
Write-Host "Not found: ${d}"
}
}
- name: Meson configure (MSVC/cl)
shell: pwsh
run: |
# Configure Meson to generate a Visual Studio solution and prefer the
# MSVC toolchain (cl). Meson will auto-detect MSVC on the GitHub
# runner; pass the extracted radare2 prefix via -Dr2_prefix.
# Normalize the prefix to forward-slash form for Meson and pass it
$prefix = 'C:\\radare2'
$posix = $prefix -replace '\\','/'
Write-Host "Passing -Dr2_prefix=$posix"
meson setup builddir --reconfigure --backend vs -Dr2_prefix=$posix
- name: Build with Meson (MSVC)
shell: pwsh
run: |
meson compile -C builddir -v
- name: Smoke test executable
shell: pwsh
run: |
$exe = Get-ChildItem -Path builddir -Filter r2mcp.exe -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -eq $exe) { Write-Host 'r2mcp.exe not found'; exit 0 }
Write-Host "Found $($exe.FullName)"
& $exe.FullName -h || Write-Host 'help failed'
- name: Package artifact
shell: pwsh
run: |
$out = "release"
New-Item -ItemType Directory -Path $out -Force | Out-Null
Copy-Item -Path (Get-ChildItem -Path builddir -Filter r2mcp.exe -Recurse | Select-Object -First 1).FullName -Destination $out -ErrorAction SilentlyContinue
if ((Get-ChildItem -Path $out -Recurse | Measure-Object).Count -eq 0) { Write-Host 'No artifacts to package' }
Compress-Archive -Path $out\* -DestinationPath r2mcp-windows-msvc.zip -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: r2mcp-windows-msvc
path: r2mcp-windows-msvc.zip
- name: Create GitHub Release (on tag)
id: create_release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: r2mcp-windows-msvc.zip
asset_name: r2mcp-windows-msvc.zip
asset_content_type: application/zip