[pull] master from TrinityCore:master #376
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows x64 | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: windows-latest | |
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@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- 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@v4 | |
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/[email protected] | |
id: install-boost | |
with: | |
boost_version: 1.84.0 | |
link: static | |
platform_version: 2022 | |
toolset: msvc | |
- name: Initialize Visual Studio Environment | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: Configure CMake | |
env: | |
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} | |
run: > | |
cmake -GNinja -S ${{ github.workspace }} -B ${{ steps.strings.outputs.build-output-dir }} | |
-DWITH_WARNINGS_AS_ERRORS=ON -DTOOLS=ON | |
- name: Build | |
run: | | |
cmake --build ${{ steps.strings.outputs.build-output-dir }} | |
- name: Copy Dependencies | |
run: | | |
cd ${{ steps.strings.outputs.build-output-dir }}/bin/${{ env.CMAKE_BUILD_TYPE }} | |
copy "${{ env.MYSQL_ROOT_DIR }}/lib/libmysql.dll" libmysql.dll | |
copy "${{ env.OPENSSL_ROOT_DIR }}/bin/libssl-3-x64.dll" libssl-3-x64.dll | |
copy "${{ env.OPENSSL_ROOT_DIR }}/bin/libcrypto-3-x64.dll" libcrypto-3-x64.dll | |
copy "${{ env.OPENSSL_ROOT_DIR }}/bin/legacy.dll" legacy.dll | |
- name: Check binaries | |
run: | | |
cd ${{ steps.strings.outputs.build-output-dir }}/bin/${{ env.CMAKE_BUILD_TYPE }} | |
./bnetserver --version | |
./worldserver --version | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ steps.strings.outputs.build-output-dir }}/bin/${{ env.CMAKE_BUILD_TYPE }} | |
name: TrinityCoreMasterWin64VS2022 | |
# Set a custom retention for artifacts | |
#retention-days: 7 |