181 lines
6.4 KiB
YAML
181 lines
6.4 KiB
YAML
name: Build (Windows x64)
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-2022
|
|
env:
|
|
CMAKE_BUILD_TYPE: RelWithDebInfo
|
|
MYSQL_ROOT_DIR: C:/Program Files/MySQL/MySQL Server 8.0
|
|
OPENSSL_ROOT_DIR: C:/libs/openssl
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Get current OpenSSL version
|
|
id: openssl-info
|
|
run: |
|
|
$VersionsUrl = "https://api.github.com/repos/slproweb/opensslhashes/contents/win32_openssl_hashes.json"
|
|
$Headers = @{
|
|
Accept="application/vnd.github.raw+json"
|
|
Authorization="Bearer ${{ secrets.GITHUB_TOKEN }}"
|
|
}
|
|
$openSSL = (Invoke-RestMethod $VersionsUrl -Headers $Headers).files.PSObject.Properties |
|
|
Select-Object -ExpandProperty Value |
|
|
Where-Object { $_.arch -eq 'INTEL' } |
|
|
Where-Object { $_.bits -eq '64' } |
|
|
Where-Object { $_.light -eq $false } |
|
|
Where-Object { $_.installer -eq 'exe' } |
|
|
Sort-Object -Descending @{ Expression = { [version]$_.basever } } |
|
|
Select-Object -First 1
|
|
[System.String]::Format("cache-key=openssl-{0}-win-{1}-{2}", $openSSL.basever, $openSSL.arch, $openSSL.bits) >> $env:GITHUB_OUTPUT
|
|
[System.String]::Format("url={0}", $openSSL.url) >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Cache OpenSSL
|
|
id: cache-openssl
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ${{ env.OPENSSL_ROOT_DIR }}
|
|
key: ${{ steps.openssl-info.outputs.cache-key }}
|
|
|
|
- name: Download and install OpenSSL 3.x
|
|
if: ${{ steps.cache-openssl.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
(New-Object System.Net.WebClient).DownloadFile("${{ steps.openssl-info.outputs.url }}", "${{ env.TEMP }}\openssl.exe")
|
|
Start-Process -Wait -FilePath "${{ env.TEMP }}\openssl.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES",/DIR=${{ env.OPENSSL_ROOT_DIR }}
|
|
|
|
# Quick OpenSSL install test
|
|
& ${{ env.OPENSSL_ROOT_DIR }}/bin/openssl.exe version
|
|
|
|
- name: Download and install Boost
|
|
uses: MarkusJx/install-boost@v2
|
|
id: install-boost
|
|
with:
|
|
boost_version: 1.89.0
|
|
link: static
|
|
platform_version: 2022
|
|
toolset: msvc
|
|
|
|
- name: Configure CMake
|
|
env:
|
|
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
|
|
OPENSSL_ROOT_DIR: C:/libs/openssl
|
|
run: >
|
|
cmake -S ${{ github.workspace }} -B build -G"Visual Studio 17 2022" -A x64
|
|
-DSCRIPTS=static
|
|
-DWITH_WARNINGS_AS_ERRORS=OFF
|
|
-DTOOLS=ON
|
|
|
|
- name: Build
|
|
run: >
|
|
cmake --build build --config RelWithDebInfo
|
|
|
|
- name: Copy Dependencies
|
|
shell: pwsh
|
|
run: |
|
|
cd build/bin/${{ env.CMAKE_BUILD_TYPE }}
|
|
Copy-Item "${{ env.MYSQL_ROOT_DIR }}/lib/libmysql.dll" .
|
|
# mysql may depend on a different version of openssl so copy its dlls first (override later with openssl's own if same version)
|
|
Copy-Item "${{ env.MYSQL_ROOT_DIR }}/bin/libcrypto-3-x64.dll" . -ErrorAction SilentlyContinue
|
|
Copy-Item "${{ env.MYSQL_ROOT_DIR }}/bin/libssl-3-x64.dll" . -ErrorAction SilentlyContinue
|
|
Copy-Item "${{ env.OPENSSL_ROOT_DIR }}/bin/libcrypto-3-x64.dll" . -ErrorAction SilentlyContinue
|
|
Copy-Item "${{ env.OPENSSL_ROOT_DIR }}/bin/libssl-3-x64.dll" . -ErrorAction SilentlyContinue
|
|
Copy-Item "${{ env.OPENSSL_ROOT_DIR }}/bin/legacy.dll" . -ErrorAction SilentlyContinue
|
|
Copy-Item "${{ env.MYSQL_ROOT_DIR }}/bin/zlib1.dll" . -ErrorAction SilentlyContinue
|
|
|
|
- name: Check binaries
|
|
shell: pwsh
|
|
run: |
|
|
cd build/bin/${{ env.CMAKE_BUILD_TYPE }}
|
|
foreach ($exe in @("bnetserver.exe", "worldserver.exe"))
|
|
{
|
|
if (-not (Test-Path $exe)) { Write-Error "Missing binary: $exe"; exit 1 }
|
|
if ((Get-Item $exe).Length -lt 1MB) { Write-Error "Suspiciously small binary: $exe"; exit 1 }
|
|
}
|
|
Write-Output "Required binaries present. Version smoke test (may fail to start in the ephemeral runner DLL env):"
|
|
cmd.exe /c "bnetserver.exe --version" 2>&1 | ForEach-Object { Write-Output " bnetserver: $_" }
|
|
cmd.exe /c "worldserver.exe --version" 2>&1 | ForEach-Object { Write-Output " worldserver: $_" }
|
|
Get-ChildItem *.dll | ForEach-Object { Write-Output " $($_.Name) ($($_.Length) bytes)" }
|
|
Write-Output "Binary + package validation passed."
|
|
exit 0
|
|
|
|
- name: Create zip
|
|
shell: pwsh
|
|
run: |
|
|
cd build/bin
|
|
7z a TrinityCoreWin64VS2022.zip .\RelWithDebInfo\* | Out-Null
|
|
Remove-Item RelWithDebInfo\*.pdb
|
|
7z a TrinityCoreWin64VS2022NoSymbols.zip .\RelWithDebInfo\* | Out-Null
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: TrinityCoreWin64VS2022
|
|
path: build/bin/TrinityCoreWin64VS2022.zip
|
|
if-no-files-found: error
|
|
|
|
- name: Upload Artifacts (NoSymbols)
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: TrinityCoreWin64VS2022NoSymbols
|
|
path: build/bin/TrinityCoreWin64VS2022NoSymbols.zip
|
|
if-no-files-found: error
|
|
|
|
linux-build:
|
|
runs-on: ubuntu-24.04
|
|
env:
|
|
CMAKE_BUILD_TYPE: RelWithDebInfo
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -yq \
|
|
ninja-build \
|
|
pkg-config \
|
|
libboost-all-dev \
|
|
libssl-dev \
|
|
libreadline-dev \
|
|
zlib1g-dev \
|
|
libbz2-dev \
|
|
default-libmysqlclient-dev \
|
|
default-mysql-client
|
|
|
|
- name: Configure CMake
|
|
run: >
|
|
cmake -GNinja -S ${{ github.workspace }} -B build-linux
|
|
-DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
|
|
-DSCRIPTS=static
|
|
-DWITH_WARNINGS_AS_ERRORS=OFF
|
|
-DTOOLS=ON
|
|
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
|
|
|
|
- name: Build
|
|
run: >
|
|
cmake --build build-linux
|
|
|
|
- name: Check binaries
|
|
run: |
|
|
cmake --install build-linux
|
|
cd ${{ github.workspace }}/install/bin
|
|
./bnetserver --version
|
|
./worldserver --version
|
|
|
|
- name: Create tar.gz
|
|
run: |
|
|
cd ${{ github.workspace }}
|
|
tar -czf TrinityCoreLinux64.tar.gz -C install .
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: TrinityCoreLinux64
|
|
path: TrinityCoreLinux64.tar.gz
|
|
if-no-files-found: error
|