Add Windows CI jobs #25
Workflow file for this run
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
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: 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. | |
meson setup builddir --reconfigure --backend vs -Dr2_prefix=C:\\radare2 | |
- 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 |