1- name : Common Toolchain
1+ name : Build Toolchain
22
33permissions :
44 contents : read
1616 type : string
1717 description : " CMake preset"
1818 tools :
19- default : false
19+ required : false
20+ default : true
2021 type : boolean
2122 description : " Build tools"
23+ extras :
24+ required : false
25+ default : false
26+ type : boolean
27+ description : " Build extras"
2228
2329jobs :
2430 build :
31+ name : Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
2532 runs-on : windows-latest
2633 timeout-minutes : 20
2734 steps :
28- - name : Checkout code
35+ - name : Checkout Code
2936 uses : actions/checkout@v4
3037
31- - name : Cache VC6 installation
38+ - name : Cache VC6 Installation
3239 if : startsWith(inputs.preset, 'vc6')
3340 id : cache-vc6
3441 uses : actions/cache@v4
@@ -54,24 +61,23 @@ jobs:
5461 EXPECTED_HASH : " 118D0F1ACBBD70C3F8B081CA4DBAF955FE0C6C359A76636E930AA89FDC551091"
5562 shell : pwsh
5663 run : |
57- Write-Host "Downloading VC6 portable installation"
64+ Write-Host "Downloading VC6 Portable Installation" -ForegroundColor Cyan
5865 aws s3 cp s3://github-ci/VS6_VisualStudio6.7z VS6_VisualStudio6.7z --endpoint-url $env:AWS_ENDPOINT_URL
5966
60- Write-Host "Verifying file integrity..."
61- $hash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
62- Write-Host "Downloaded file SHA256: $hash "
63- Write-Host "Expected SHA256: $env:EXPECTED_HASH"
67+ Write-Host "Verifying File Integrity" -ForegroundColor Cyan
68+ $fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
69+ Write-Host "Downloaded file SHA256: $fileHash "
70+ Write-Host "Expected file SHA256: $env:EXPECTED_HASH"
6471 if ($hash -ne $env:EXPECTED_HASH) {
6572 Write-Error "Hash verification failed! File may be corrupted or tampered with."
6673 exit 1
6774 }
6875
69- Write-Host "Extracting archive..."
76+ Write-Host "Extracting Archive" -ForegroundColor Cyan
7077 & 7z x VS6_VisualStudio6.7z -oC:\VC6
71-
7278 Remove-Item VS6_VisualStudio6.7z -Verbose
7379
74- - name : Set up VC6 environment
80+ - name : Set Up VC6 Environment
7581 if : startsWith(inputs.preset, 'vc6')
7682 shell : pwsh
7783 run : |
@@ -90,41 +96,52 @@ jobs:
9096 "INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV
9197 "LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
9298
93- - name : Build ${{ inputs.game }} with CMake using ${{ inputs.preset }} preset
99+ - name : Set Up VC2022 Environment
100+ if : startsWith(inputs.preset, 'win32')
101+ uses : ilammy/msvc-dev-cmd@v1
102+ with :
103+ arch : x86
104+
105+ - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
94106 shell : pwsh
95107 run : |
96- Write-Host "Configuring project with CMake using preset: ${{ inputs.game }} (${{ inputs.preset }})"
97-
98- # Set build flags based on game and tools
99- if ("${{ inputs.game }}" -eq "Generals") {
100- $buildFlags = @("-DGENZH_BUILD_ZEROHOUR=OFF", "-DGENZH_BUILD_GENERALS=ON")
101- if ("${{ inputs.tools }}" -eq "true") {
102- $buildFlags += "-DGENZH_BUILD_GENERALS_TOOLS=ON"
103- }
104- } else {
105- $buildFlags = @("-DGENZH_BUILD_ZEROHOUR=ON", "-DGENZH_BUILD_GENERALS=OFF")
106- if ("${{ inputs.tools }}" -eq "true") {
107- $buildFlags += "-DGENZH_BUILD_ZEROHOUR_TOOLS=ON"
108- }
109- }
108+ $buildFlags = @(
109+ "-DGENZH_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
110+ "-DGENZH_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
111+ )
110112
111- cmake --preset ${{ inputs.preset }} $buildFlags
113+ $gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
114+ $buildFlags += "-DGENZH_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
115+ $buildFlags += "-DGENZH_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
112116
113- Write-Host "Building project with CMake using preset : ${{ inputs.game }} (${{ inputs.preset }}) "
117+ Write-Host "Build flags : $buildFlags "
114118
115- $buildDir = "build\ ${{ inputs.preset }}"
119+ cmake --preset ${{ inputs.preset }} $buildFlags
116120
117- cmake --build $buildDir
121+ - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
122+ shell : pwsh
123+ run : |
124+ cmake --build --preset ${{ inputs.preset }}
118125
119- Write-Host "Collecting ${{ inputs.game }} artifacts"
126+ - name : Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
127+ shell : pwsh
128+ run : |
129+ $buildDir = "build\${{ inputs.preset }}"
120130 $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
121- $files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
131+
132+ if ("${{ inputs.preset }}" -like "win32*") {
133+ # For win32 preset, look in config-specific subdirectories
134+ $configToUse = if ("${{ inputs.preset }}" -eq "win32dbg") { "Debug" } else { "Release" }
135+ $files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
136+ } else {
137+ $files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
138+ }
122139 $files | Move-Item -Destination $artifactsDir -Verbose
123140
124- - name : Upload ${{ inputs.game }} ( ${{ inputs.preset }}) artifact
141+ - name : Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
125142 uses : actions/upload-artifact@v4
126143 with :
127- name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools == true && '+tools ' || '' }}
144+ name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e ' || '' }}
128145 path : build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
129146 retention-days : 30
130147 if-no-files-found : error
0 commit comments