xenia/.github/workflows/Windows_build.yml

159 lines
5.4 KiB
YAML

name: Windows build
on:
push:
paths-ignore:
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
- '.github/*'
- '.github/workflows/Linux_build.yml'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- '*.txt'
- 'docs/**'
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
- 'LICENSE'
pull_request:
paths-ignore:
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
- '.github/*'
- '.github/workflows/Linux_build.yml'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- '*.txt'
- 'docs/**'
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
- 'LICENSE'
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: windows-latest
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@main
- name: Lint
run: python xenia-build.py lint --all
build:
name: Build
needs: lint
runs-on: windows-2025
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Cache Vulkan SDK
id: cache-vulkan-sdk
uses: actions/cache@v4
with:
path: C:\VulkanSDK
key: ${{ runner.os }}-vulkan-sdk-${{ hashFiles('**/vulkan-sdk.exe') }}
restore-keys: |
${{ runner.os }}-vulkan-sdk-
- name: Setup
run: |
# Install Vulkan SDK which includes spirv-tools
if (Test-Path -Path "C:\VulkanSDK") {
echo "Vulkan SDK found in cache."
} else {
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe" -OutFile "vulkan-sdk.exe"
Start-Process -FilePath "vulkan-sdk.exe" -ArgumentList "--accept-licenses", "--default-answer", "--confirm-command", "install" -Wait
}
$env:VULKAN_SDK = "C:\VulkanSDK\$(Get-ChildItem -Path 'C:\VulkanSDK' -Directory | Select-Object -First 1 -ExpandProperty Name)"
$env:PATH = "$env:VULKAN_SDK\Bin;$env:PATH"
echo "VULKAN_SDK=$env:VULKAN_SDK" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:VULKAN_SDK\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Verify shader tools are available
$spirvOptPath = "$env:VULKAN_SDK\Bin\spirv-opt.exe"
if (Test-Path $spirvOptPath) {
& $spirvOptPath --version
echo "spirv-opt found at: $spirvOptPath"
} else {
echo "Warning: spirv-opt.exe not found at expected location"
}
$glslangPath = "$env:VULKAN_SDK\Bin\glslangValidator.exe"
if (Test-Path $glslangPath) {
& $glslangPath --version
echo "glslangValidator found at: $glslangPath"
} else {
echo "Warning: glslangValidator.exe not found at expected location"
}
$spirvDisPath = "$env:VULKAN_SDK\Bin\spirv-dis.exe"
if (Test-Path $spirvDisPath) {
echo "spirv-dis found at: $spirvDisPath"
} else {
echo "Warning: spirv-dis.exe not found at expected location"
}
# Verify FXC is available (from Windows SDK)
$fxcPaths = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\fxc.exe" -ErrorAction SilentlyContinue | Sort-Object FullName
if ($fxcPaths) {
$fxcPath = $fxcPaths[-1].FullName
echo "FXC found at: $fxcPath"
} else {
echo "Warning: fxc.exe not found in Windows SDK"
}
git submodule update --init --depth=1 -j $env:NUMBER_OF_PROCESSORS (Select-String -CaseSensitive '(?<=path = ).+' .gitmodules).Matches.Value
- name: Build
run: python xenia-build.py build --config=Release --target=xenia-app
- name: Prepare artifacts
id: prepare_artifacts
run: |
foreach ($file in 'build\bin\Windows\Release\xenia_canary.exe') {
if ((get-item $file).Length -le 100000) {
echo "::error::$file is too small."
}
}
robocopy . build\bin\Windows\Release LICENSE /r:0 /w:0
robocopy build\bin\Windows\Release artifacts\xenia_canary xenia_canary.exe LICENSE /r:0 /w:0
If ($LastExitCode -le 7) { echo "LastExitCode = $LastExitCode";$LastExitCode = 0 }
- name: Upload xenia canary artifacts
if: steps.prepare_artifacts.outcome == 'success'
uses: actions/upload-artifact@main
with:
name: xenia_canary_windows
path: artifacts\xenia_canary
if-no-files-found: error
create-release:
name: Create release
needs: [lint, build]
if: |
github.repository == 'xenia-canary/xenia-canary' &&
github.event.action != 'pull_request' &&
github.ref == 'refs/heads/canary_experimental'
uses: ./.github/workflows/Create_release.yml
with:
os: windows
secrets:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}