Update README #24
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: 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: | | |
| $vsPath = (& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
| Write-Host "VS installation path: $vsPath" | |
| # The documented CLI engine for modify is setup.exe, NOT vs_installer.exe. | |
| # vs_installer.exe is the GUI app and rejects headless `modify --quiet` | |
| # with ERROR_INVALID_PARAMETER (87). | |
| $setupExe = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" | |
| if (-not (Test-Path $setupExe)) { | |
| throw "setup.exe not found at $setupExe" | |
| } | |
| $argList = @( | |
| "modify", | |
| "--installPath", "`"$vsPath`"", | |
| "--add", "Microsoft.VisualStudio.Component.VC.ATLMFC", | |
| "--quiet", "--norestart", "--force", "--nocache" | |
| ) | |
| Write-Host "Running: $setupExe $($argList -join ' ')" | |
| $proc = Start-Process -FilePath $setupExe -ArgumentList $argList -Wait -PassThru | |
| Write-Host "setup.exe exit code: $($proc.ExitCode)" | |
| # On failure, surface the real diagnostics: the dd_*.log files in %TEMP%. | |
| if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) { | |
| Write-Host "----- Recent dd_*.log files in TEMP -----" | |
| Get-ChildItem "$env:TEMP\dd_*.log" -ErrorAction SilentlyContinue | | |
| Sort-Object LastWriteTime -Descending | Select-Object -First 5 | ForEach-Object { | |
| Write-Host "===== $($_.FullName) =====" | |
| Get-Content $_.FullName -Tail 60 | |
| } | |
| throw "setup.exe modify failed with exit code $($proc.ExitCode)" | |
| } | |
| $mfcRoot = Join-Path $vsPath "VC\Tools\MSVC" | |
| $found = Get-ChildItem -Path $mfcRoot -Recurse -Filter "afxwin.h" -ErrorAction SilentlyContinue | |
| if (-not $found) { | |
| throw "ATLMFC install reported success but afxwin.h was not found under $mfcRoot" | |
| } | |
| 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 -Directory | | |
| Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } | | |
| Sort-Object { [version]$_.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 | |
| permissions: | |
| contents: write | |
| 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 |