infinipaint/.github/workflows/windows_release.yml
copilot 97b136de3b
Some checks failed
Windows Release / windows-x86_64 (push) Has been cancelled
Fix Windows CI for MSVC 195 on windows-latest
Generate a win-ci Conan host profile from the runner-detected MSVC
version instead of pinning 194 (VS 17), which is missing on current
GitHub-hosted images.
2026-10-04 20:18:33 +02:00

131 lines
4.9 KiB
YAML

name: Windows Release
# Continuous Windows portable build on every push to main.
# Uses GitHub-hosted windows-latest (MSVC preinstalled).
# See docs/windows-runner.md
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: infinipaint-windows-release
cancel-in-progress: true
jobs:
windows-x86_64:
runs-on: windows-latest
timeout-minutes: 360
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Conan
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m pip install "conan>=2,<3"
conan --version
# Fresh runners: detect MSVC (windows-latest is currently 195 / VS 18).
conan profile detect --force
$default = Join-Path $env:USERPROFILE ".conan2\profiles\default"
$verLine = Select-String -Path $default -Pattern 'compiler.version=' | Select-Object -First 1
$msvcVer = ($verLine.Line -split '=')[1].Trim()
if (-not $msvcVer) { throw "could not read compiler.version from default profile" }
# Host profile matching the runner (repo win-x86_64 still pins 194 for local Tower).
$p = Join-Path $env:USERPROFILE ".conan2\profiles\win-ci"
@"
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=23
compiler.runtime=dynamic
compiler.version=$msvcVer
os=Windows
"@.Trim() | Set-Content -Path $p -Encoding ascii
Write-Host "win-ci MSVC version=$msvcVer"
Get-Content $p
- name: Resolve version
id: ver
shell: bash
run: |
set -euo pipefail
ver="$(grep -E 'CURRENT_VERSION_STRING' src/VersionConstants.hpp | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
short_sha="$(echo "${GITHUB_SHA}" | cut -c1-7)"
asset_ver="${ver}+${short_sha}"
zip_name="infinipaint-${asset_ver}-win-x86_64-portable.zip"
{
echo "version=${ver}"
echo "tag=windows-continuous"
echo "asset_ver=${asset_ver}"
echo "zip_name=${zip_name}"
} >> "$GITHUB_OUTPUT"
- name: Build Windows x86_64
shell: cmd
run: |
call .\conan\export_libs.bat
if errorlevel 1 exit /b 1
conan install . -of=build-x86_64 --build=missing -pr:h=win-ci -pr:b=default
if errorlevel 1 exit /b 1
call windowsinstall\build_x86_64.bat
if errorlevel 1 exit /b 1
- name: Package portable zip
id: pkg
shell: pwsh
env:
ZIP_NAME: ${{ steps.ver.outputs.zip_name }}
run: |
$ErrorActionPreference = "Stop"
$exe = Get-ChildItem -Path . -Recurse -Filter infinipaint.exe |
Where-Object { $_.FullName -match 'Release' } |
Select-Object -First 1
if (-not $exe) { throw "infinipaint.exe not found under Release" }
$outDir = Join-Path (Get-Location) "dist\portable"
Remove-Item -Recurse -Force $outDir -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
Copy-Item $exe.FullName (Join-Path $outDir "infinipaint.exe")
$dllDir = Join-Path (Get-Location) "windowsinstall\dlls-x86_64"
if (Test-Path $dllDir) {
Copy-Item (Join-Path $dllDir "*.dll") $outDir -ErrorAction SilentlyContinue
}
$dataSrc = Join-Path (Get-Location) "assets\data"
if (-not (Test-Path $dataSrc)) { $dataSrc = Join-Path (Get-Location) "data" }
Copy-Item -Recurse $dataSrc (Join-Path $outDir "data")
New-Item -ItemType Directory -Force -Path "dist" | Out-Null
$zipPath = Join-Path (Get-Location) "dist\$env:ZIP_NAME"
if (Test-Path $zipPath) { Remove-Item $zipPath }
Compress-Archive -Path (Join-Path $outDir "*") -DestinationPath $zipPath
"zip_path=$zipPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
Get-Item $zipPath | Format-List FullName, Length
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.ver.outputs.tag }}
name: Windows continuous (${{ steps.ver.outputs.asset_ver }})
prerelease: true
body: |
Continuous Windows build from `main`.
- Version: **${{ steps.ver.outputs.version }}**
- Commit: `${{ github.sha }}`
- Asset: `${{ steps.ver.outputs.zip_name }}`
Updated on every push to `main`. Built on GitHub-hosted `windows-latest`.
files: dist/${{ steps.ver.outputs.zip_name }}
fail_on_unmatched_files: true