Skip to content

ci: pin runner to windows-2022 #12

ci: pin runner to windows-2022

ci: pin runner to windows-2022 #12

Workflow file for this run

name: Build NanoSIP
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Install MFC/ATL components
shell: pwsh
run: |
$installerExe = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe"
$vsPath = (& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Write-Host "VS installation path: $vsPath"
$logFile = "$env:TEMP\vs_modify_log.txt"
$args = @(
"modify",
"--installPath", $vsPath,
"--add", "Microsoft.VisualStudio.Component.VC.ATLMFC",
"--quiet", "--norestart", "--wait",
"--log", $logFile
)
Write-Host "Running: $installerExe $($args -join ' ')"
$proc = Start-Process -FilePath $installerExe -ArgumentList $args -Wait -PassThru -NoNewWindow
Write-Host "vs_installer exit code: $($proc.ExitCode)"
if (Test-Path $logFile) {
Write-Host "----- vs_installer log (last 200 lines) -----"
Get-Content $logFile -Tail 200
}
if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) {
throw "vs_installer failed with exit code $($proc.ExitCode)"
}
$mfcHeader = Join-Path $vsPath "VC\Tools\MSVC"
$found = Get-ChildItem -Path $mfcHeader -Recurse -Filter "afxwin.h" -ErrorAction SilentlyContinue
if (-not $found) {
throw "ATLMFC install reported success but afxwin.h was not found under $mfcHeader"
}
Write-Host "MFC headers found at: $($found[0].FullName)"
- name: Detect installed Windows SDK version
shell: pwsh
run: |
$sdkRoot = "C:\Program Files (x86)\Windows Kits\10\Include"
$sdkVersion = (Get-ChildItem $sdkRoot | Sort-Object Name -Descending | Select-Object -First 1).Name
if (-not $sdkVersion) {
throw "No Windows 10 SDK found under $sdkRoot"
}
Write-Host "Using Windows SDK $sdkVersion"
echo "SDK_VERSION=$sdkVersion" >> $env:GITHUB_ENV
- name: Build NanoSIP.exe (Release / Win32)
shell: pwsh
run: |
msbuild "NanoSIP\microsip.vcxproj" `
/p:Configuration=Release /p:Platform=Win32 `
/p:PlatformToolset=v143 /p:WindowsTargetPlatformVersion=$env:SDK_VERSION `
/t:Build /m
- name: Upload NanoSIP.exe artifact
uses: actions/upload-artifact@v4
with:
name: NanoSIP-${{ github.sha }}
path: NanoSIP/Release/NanoSIP.exe
if-no-files-found: error
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: NanoSIP-${{ github.sha }}
path: dist
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/NanoSIP.exe