xpmgr/.github/workflows/windows.yml

89 lines
3.4 KiB
YAML

name: C/C++ CI (Windows)
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
steps:
# https://github.com/actions/runner-images/issues/6067#issuecomment-1213069040
- name: Download Windows XP Support for Visual Studio
run: |
if (Test-Path -Path "D:\a\VSLayout\Microsoft.Windows.XPSupport.Msi,version=11.0.51106.1,chip=x64\Win_XPSupport64.msi") {
Write-Host "components already downloaded"
exit 0
}
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToAdd = @(
"Microsoft.VisualStudio.Component.WinXP"
)
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
Invoke-WebRequest -URI "https://aka.ms/vs/17/release/vs_enterprise.exe" -OutFile "D:\a\_temp\vs_enterprise.exe"
$Arguments = ('--layout', 'D:\a\VSLayout', $workloadArgs, '--silent')
$process = Start-Process -FilePath "D:\a\_temp\vs_enterprise.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle -RedirectStandardOutput -Hidden
if ($process.ExitCode -eq 0)
{
Write-Host "components have been successfully downloaded"
Get-ChildItem D:\a\VSLayout\Microsoft.Windows.XPSupport.*
}
else
{
Write-Host "components were not downloaded".
exit 1
}
- name: Install Windows XP Support for Visual Studio
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToAdd = @(
"Microsoft.VisualStudio.Component.WinXP"
)
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache', '--layout D:\a\VSLayout', '--noweb')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
if ($process.ExitCode -eq 0)
{
Write-Host "components have been successfully added"
Get-ChildItem C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Windows.XPSupport.*
}
else
{
Write-Host "components were not installed"
exit 1
}
- name: Checkout Source Tree
uses: actions/checkout@v3
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Build xpmgr (x86)
run: msbuild xpmgr.vcxproj /P:Configuration=Release /P:Platform=Win32
- name: Build xpmgr (x64)
run: msbuild xpmgr.vcxproj /P:Configuration=Release /P:Platform=x64
- name: Upload build artifact (x86)
uses: actions/upload-artifact@v3.1.2
with:
name: xpmgr (x86)
path: .\Win32\Release
- name: Upload build artifact (x64)
uses: actions/upload-artifact@v3.1.2
with:
name: xpmgr (x64)
path: .\x64\Release
- name: Cache XP Support for Visual Studio
uses: actions/cache@v3
with:
path: D:\a\VSLayout