1
- name : Common Toolchain
1
+ name : Build Toolchain
2
2
3
3
permissions :
4
4
contents : read
16
16
type : string
17
17
description : " CMake preset"
18
18
tools :
19
- default : false
19
+ required : false
20
+ default : true
20
21
type : boolean
21
22
description : " Build tools"
23
+ extras :
24
+ required : false
25
+ default : false
26
+ type : boolean
27
+ description : " Build extras"
22
28
23
29
jobs :
24
30
build :
31
+ name : Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
25
32
runs-on : windows-latest
26
33
timeout-minutes : 20
27
34
steps :
28
- - name : Checkout code
35
+ - name : Checkout Code
29
36
uses : actions/checkout@v4
30
37
31
- - name : Cache VC6 installation
38
+ - name : Cache VC6 Installation
32
39
if : startsWith(inputs.preset, 'vc6')
33
40
id : cache-vc6
34
41
uses : actions/cache@v4
@@ -54,24 +61,23 @@ jobs:
54
61
EXPECTED_HASH : " 118D0F1ACBBD70C3F8B081CA4DBAF955FE0C6C359A76636E930AA89FDC551091"
55
62
shell : pwsh
56
63
run : |
57
- Write-Host "Downloading VC6 portable installation"
64
+ Write-Host "Downloading VC6 Portable Installation" -ForegroundColor Cyan
58
65
aws s3 cp s3://github-ci/VS6_VisualStudio6.7z VS6_VisualStudio6.7z --endpoint-url $env:AWS_ENDPOINT_URL
59
66
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"
64
71
if ($hash -ne $env:EXPECTED_HASH) {
65
72
Write-Error "Hash verification failed! File may be corrupted or tampered with."
66
73
exit 1
67
74
}
68
75
69
- Write-Host "Extracting archive..."
76
+ Write-Host "Extracting Archive" -ForegroundColor Cyan
70
77
& 7z x VS6_VisualStudio6.7z -oC:\VC6
71
-
72
78
Remove-Item VS6_VisualStudio6.7z -Verbose
73
79
74
- - name : Set up VC6 environment
80
+ - name : Set Up VC6 Environment
75
81
if : startsWith(inputs.preset, 'vc6')
76
82
shell : pwsh
77
83
run : |
@@ -90,43 +96,52 @@ jobs:
90
96
"INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV
91
97
"LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
92
98
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
94
106
shell : pwsh
95
107
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
- $buildFlags += "-DGENZH_BUILD_GENERALS_EXTRAS=ON"
104
- }
105
- } else {
106
- $buildFlags = @("-DGENZH_BUILD_ZEROHOUR=ON", "-DGENZH_BUILD_GENERALS=OFF")
107
- if ("${{ inputs.tools }}" -eq "true") {
108
- $buildFlags += "-DGENZH_BUILD_ZEROHOUR_TOOLS=ON"
109
- $buildFlags += "-DGENZH_BUILD_ZEROHOUR_EXTRAS=ON"
110
- }
111
- }
108
+ $buildFlags = @(
109
+ "-DGENZH_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
110
+ "-DGENZH_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
111
+ )
112
112
113
- 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' }}"
114
116
115
- Write-Host "Building project with CMake using preset : ${{ inputs.game }} (${{ inputs.preset }}) "
117
+ Write-Host "Build flags : $buildFlags "
116
118
117
- $buildDir = "build\ ${{ inputs.preset }}"
119
+ cmake --preset ${{ inputs.preset }} $buildFlags
118
120
119
- 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 }}
120
125
121
- 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 }}"
122
130
$artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
123
- $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
+ }
124
139
$files | Move-Item -Destination $artifactsDir -Verbose
125
140
126
- - name : Upload ${{ inputs.game }} ( ${{ inputs.preset }}) artifact
141
+ - name : Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
127
142
uses : actions/upload-artifact@v4
128
143
with :
129
- name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools == true && '+tools ' || '' }}
144
+ name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e ' || '' }}
130
145
path : build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
131
146
retention-days : 30
132
147
if-no-files-found : error
0 commit comments