|
| 1 | +name: Windows x64 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: windows-latest |
| 10 | + env: |
| 11 | + CMAKE_BUILD_TYPE: RelWithDebInfo |
| 12 | + MYSQL_ROOT_DIR: C:/Program Files/MySQL/MySQL Server 8.0 |
| 13 | + OPENSSL_ROOT_DIR: C:/libs/openssl |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v5 |
| 16 | + |
| 17 | + - name: Set reusable strings |
| 18 | + id: strings |
| 19 | + shell: bash |
| 20 | + run: | |
| 21 | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" |
| 22 | +
|
| 23 | + - name: Get current OpenSSL version |
| 24 | + id: openssl-info |
| 25 | + run: | |
| 26 | + $VersionsUrl = "https://api.github.com/repos/slproweb/opensslhashes/contents/win32_openssl_hashes.json" |
| 27 | + $Headers = @{ |
| 28 | + Accept="application/vnd.github.raw+json" |
| 29 | + Authorization="Bearer ${{ secrets.GITHUB_TOKEN }}" |
| 30 | + } |
| 31 | + $openSSL = (Invoke-RestMethod $VersionsUrl -Headers $Headers).files.PSObject.Properties | |
| 32 | + Select-Object -ExpandProperty Value | |
| 33 | + Where-Object { $_.arch -eq 'INTEL' } | |
| 34 | + Where-Object { $_.bits -eq '64' } | |
| 35 | + Where-Object { $_.light -eq $false } | |
| 36 | + Where-Object { $_.installer -eq 'exe' } | |
| 37 | + Sort-Object -Descending @{ Expression = { [version]$_.basever } } | |
| 38 | + Select-Object -First 1 |
| 39 | + [System.String]::Format("cache-key=openssl-{0}-win-{1}-{2}", $openSSL.basever, $openSSL.arch, $openSSL.bits) >> $env:GITHUB_OUTPUT |
| 40 | + [System.String]::Format("url={0}", $openSSL.url) >> $env:GITHUB_OUTPUT |
| 41 | +
|
| 42 | + - name: Cache OpenSSL |
| 43 | + id: cache-openssl |
| 44 | + uses: actions/cache@v4 |
| 45 | + with: |
| 46 | + path: ${{ env.OPENSSL_ROOT_DIR }} |
| 47 | + key: ${{ steps.openssl-info.outputs.cache-key }} |
| 48 | + |
| 49 | + - name: Download and install Openssl 3.x |
| 50 | + if: ${{ steps.cache-openssl.outputs.cache-hit != 'true' }} |
| 51 | + run: | |
| 52 | + (New-Object System.Net.WebClient).DownloadFile("${{ steps.openssl-info.outputs.url }}", "${{ env.TEMP }}\openssl.exe") |
| 53 | + Start-Process -Wait -FilePath "${{ env.TEMP }}\openssl.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES",/DIR=${{ env.OPENSSL_ROOT_DIR }} |
| 54 | +
|
| 55 | + # Quick Openssl install test |
| 56 | + & ${{ env.OPENSSL_ROOT_DIR }}/bin/openssl.exe version |
| 57 | +
|
| 58 | + - name: Download and install Boost |
| 59 | + uses: MarkusJx/install-boost@v2 |
| 60 | + id: install-boost |
| 61 | + with: |
| 62 | + boost_version: 1.84.0 |
| 63 | + link: static |
| 64 | + platform_version: 2022 |
| 65 | + toolset: msvc |
| 66 | + |
| 67 | + - name: Initialize Visual Studio Environment |
| 68 | + uses: egor-tensin/vs-shell@v2 |
| 69 | + with: |
| 70 | + arch: x64 |
| 71 | + |
| 72 | + - name: Configure CMake |
| 73 | + env: |
| 74 | + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} |
| 75 | + run: > |
| 76 | + cmake -GNinja -S ${{ github.workspace }} -B ${{ steps.strings.outputs.build-output-dir }} |
| 77 | + -DWITH_WARNINGS_AS_ERRORS=ON -DTOOLS=ON |
| 78 | +
|
| 79 | + - name: Build |
| 80 | + run: | |
| 81 | + cmake --build ${{ steps.strings.outputs.build-output-dir }} |
| 82 | +
|
| 83 | + - name: Copy Dependencies |
| 84 | + run: | |
| 85 | + cd ${{ steps.strings.outputs.build-output-dir }}/bin/${{ env.CMAKE_BUILD_TYPE }} |
| 86 | + copy "${{ env.MYSQL_ROOT_DIR }}/lib/libmysql.dll" libmysql.dll |
| 87 | + # mysql may depend on a different version of openssl so copy its dlls first (override later with openssl's own if same version) |
| 88 | + Copy-Item -Path "${{ env.MYSQL_ROOT_DIR }}/bin/*" -Include libcrypto*,libssl* -Destination . |
| 89 | + Copy-Item -Path "${{ env.OPENSSL_ROOT_DIR }}/bin/*" -Include libcrypto*,libssl*,legacy* -Destination . |
| 90 | +
|
| 91 | + - name: Check binaries |
| 92 | + run: | |
| 93 | + cd ${{ steps.strings.outputs.build-output-dir }}/bin/${{ env.CMAKE_BUILD_TYPE }} |
| 94 | + ./authserver --version |
| 95 | + ./worldserver --version |
| 96 | +
|
| 97 | + - name: Upload Artifacts |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + path: ${{ steps.strings.outputs.build-output-dir }}/bin/${{ env.CMAKE_BUILD_TYPE }} |
| 101 | + name: TrinityCore335Win64VS2022 |
| 102 | + # Set a custom retention for artifacts |
| 103 | + #retention-days: 7 |
0 commit comments