CI/GitHub: Add Windows x86_64 CI (github actions) support. (#29773)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
(cherry picked from commit 19232ed2b6)
This commit is contained in:
Fabian König
2024-05-31 22:08:40 +02:00
committed by Ovahlord
parent 50eb64d331
commit 2d083cd895
3 changed files with 82 additions and 3 deletions

79
.github/workflows/win-x64-build.yml vendored Normal file
View File

@@ -0,0 +1,79 @@
name: Windows x64
on:
push:
pull_request:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Set Environment Variables
run: |
echo "OPENSSL_ROOT_DIR=C:/libs/openssl" >> $env:GITHUB_ENV
echo "MYSQL_ROOT_DIR=C:/Program Files/MySQL/MySQL Server 8.0" >> $env:GITHUB_ENV
- name: Download and install Openssl 3.x
run: |
$Url = "https://slproweb.com/download/Win64OpenSSL-3_2_1.exe"
(New-Object System.Net.WebClient).DownloadFile($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.4.5
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:
CXXFLAGS: /WX
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
run: >
cmake -GNinja -S ${{ github.workspace }} -B ${{ steps.strings.outputs.build-output-dir }}
-DTOOLS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build
run: |
cmake --build ${{ steps.strings.outputs.build-output-dir }}
- name: Copy Dependencies
run: |
cd ${{ steps.strings.outputs.build-output-dir }}/bin
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
./bnetserver --version
./worldserver --version
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
path: ${{ steps.strings.outputs.build-output-dir }}/bin
name: TrinityCoreMasterWin64VS2022
# Set a custom retention for artifacts
#retention-days: 7

View File

@@ -70,7 +70,7 @@ if (COPY_CONF AND WIN32)
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
)
elseif (MINGW)
else ()
add_custom_command(TARGET bnetserver
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.conf.dist ${CMAKE_BINARY_DIR}/bin/
@@ -85,7 +85,7 @@ if (WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.cert.pem ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.key.pem ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
)
elseif (MINGW)
else ()
add_custom_command(TARGET bnetserver
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.cert.pem ${CMAKE_BINARY_DIR}/bin/

View File

@@ -82,7 +82,7 @@ if(COPY_CONF AND WIN32)
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
)
elseif(MINGW)
else()
add_custom_command(TARGET worldserver
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/