Files

111 lines
4.3 KiB
YAML

name: Windows x64 build
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: windows-build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
windows-build:
name: Windows x64 / servers and scripts
runs-on: windows-2022
timeout-minutes: 120
defaults:
run:
shell: pwsh
steps:
- name: Checkout PR merge
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Discover Windows dependencies
run: |
$mysqlRoot = Get-ChildItem "$env:ProgramFiles/MySQL" -Directory |
Where-Object { Test-Path (Join-Path $_.FullName 'lib/libmysql.lib') } |
Sort-Object Name -Descending | Select-Object -First 1
if (!$mysqlRoot) { throw 'MySQL development installation missing from windows-2022' }
$opensslRoot = Join-Path $env:ProgramFiles 'OpenSSL'
if (!(Test-Path "$opensslRoot/include/openssl/ssl.h")) { throw 'OpenSSL development headers missing' }
"MYSQL_ROOT_DIR=$($mysqlRoot.FullName)" >> $env:GITHUB_ENV
"OPENSSL_ROOT_DIR=$opensslRoot" >> $env:GITHUB_ENV
& "$opensslRoot/bin/openssl.exe" version
if ($LASTEXITCODE -ne 0) { throw 'OpenSSL validation failed' }
& "$($mysqlRoot.FullName)/bin/mysql.exe" --version
if ($LASTEXITCODE -ne 0) { throw 'MySQL validation failed' }
- name: Install Boost 1.89.0
id: boost
uses: MarkusJx/install-boost@f9d34f6fe427b8f2ae424d7bf2a3ebccb0dae5a3 # v2.6.0
with:
boost_version: 1.89.0
platform_version: 2022
toolset: msvc
link: static
arch: x86
- name: Initialize MSVC x64
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: amd64
- name: Check housing migrations and data preservation
run: ./contrib/ci/Test-HousingSql.ps1 -MySqlRoot $env:MYSQL_ROOT_DIR
- name: Configure servers and all static scripts
env:
BOOST_ROOT: ${{ steps.boost.outputs.BOOST_ROOT }}
run: |
cmake -S . -B build -G Ninja -DCMAKE_NINJA_FORCE_RESPONSE_FILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSERVERS=ON -DSCRIPTS=static -DTOOLS=OFF -DBUILD_TESTING=OFF -DUSE_COREPCH=ON -DUSE_SCRIPTPCH=ON
if ($LASTEXITCODE -ne 0) { throw 'CMake configuration failed' }
- name: Build Windows binaries
run: |
cmake --build build --parallel 2 -- -k 20
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed' }
- name: Copy runtime dependencies and check binaries
run: |
$outputDir = Join-Path $env:GITHUB_WORKSPACE 'build/bin/RelWithDebInfo'
Copy-Item "$env:MYSQL_ROOT_DIR/lib/libmysql.dll" $outputDir
Get-ChildItem "$env:MYSQL_ROOT_DIR/bin" -File |
Where-Object { $_.Name -match '^(libcrypto|libssl).*\.dll$' } |
Copy-Item -Destination $outputDir
Get-ChildItem "$env:OPENSSL_ROOT_DIR/bin" -File |
Where-Object { $_.Name -match '^(libcrypto|libssl|legacy).*\.dll$' } |
Copy-Item -Destination $outputDir
Push-Location $outputDir
try {
& ./bnetserver.exe --version
if ($LASTEXITCODE -ne 0) { throw 'bnetserver version check failed' }
& ./worldserver.exe --version
if ($LASTEXITCODE -ne 0) { throw 'worldserver version check failed' }
} finally { Pop-Location }
- name: Upload Windows binaries
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: WowCommunityProject-Windows-x64-${{ github.sha }}
path: build/bin/RelWithDebInfo/
if-no-files-found: error
retention-days: 14
- name: Upload configuration logs on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Windows-build-diagnostics-${{ github.sha }}
path: |
build/CMakeCache.txt
build/CMakeFiles/CMakeConfigureLog.yaml
if-no-files-found: ignore
retention-days: 7