14
14
preset :
15
15
required : true
16
16
type : string
17
- description : " CMake preset"
17
+ description : " CMake configure preset"
18
18
tools :
19
19
required : false
20
20
default : true
36
36
uses : actions/checkout@v4
37
37
38
38
- name : Cache VC6 Installation
39
- if : startsWith (inputs.preset, 'vc6')
39
+ if : endsWith (inputs.preset, 'vc6')
40
40
id : cache-vc6
41
41
uses : actions/cache@v4
42
42
with :
51
51
key : cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
52
52
53
53
- name : Download VC6 Portable from Cloudflare R2
54
- if : ${{ startsWith (inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
54
+ if : ${{ endsWith (inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
55
55
env :
56
56
AWS_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
57
57
AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
66
66
$fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
67
67
Write-Host "Downloaded file SHA256: $fileHash"
68
68
Write-Host "Expected file SHA256: $env:EXPECTED_HASH"
69
- if ($hash -ne $env:EXPECTED_HASH) {
69
+ if ($fileHash -ne $env:EXPECTED_HASH) {
70
70
Write-Error "Hash verification failed! File may be corrupted or tampered with."
71
71
exit 1
72
72
}
@@ -76,16 +76,13 @@ jobs:
76
76
Remove-Item VS6_VisualStudio6.7z -Verbose
77
77
78
78
- name : Set Up VC6 Environment
79
- if : startsWith (inputs.preset, 'vc6')
79
+ if : endsWith (inputs.preset, 'vc6')
80
80
shell : pwsh
81
81
run : |
82
- # Define the base directories as local variables first
83
82
$VSCommonDir = "C:\VC6\VC6SP6\Common"
84
83
$MSDevDir = "C:\VC6\VC6SP6\Common\msdev98"
85
84
$MSVCDir = "C:\VC6\VC6SP6\VC98"
86
85
$VcOsDir = "WINNT"
87
-
88
- # Set the variables in GitHub environment
89
86
"VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV
90
87
"MSDevDir=$MSDevDir" >> $env:GITHUB_ENV
91
88
"MSVCDir=$MSVCDir" >> $env:GITHUB_ENV
@@ -95,56 +92,37 @@ jobs:
95
92
"LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
96
93
97
94
- name : Set Up VC2022 Environment
98
- if : startsWith (inputs.preset, 'win32')
95
+ if : ${{ !endsWith (inputs.preset, 'vc6') }}
99
96
uses : ilammy/msvc-dev-cmd@v1
100
97
with :
101
98
arch : x86
102
99
103
- - name : Setup vcpkg
104
- uses : lukka/run-vcpkg@v11
105
-
106
- - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
100
+ - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}
107
101
shell : pwsh
108
102
run : |
109
103
$buildFlags = @(
110
- "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
111
- "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
104
+ "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
105
+ "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
112
106
)
113
-
114
107
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
115
108
$buildFlags += "-DRTS_BUILD_CORE_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
116
109
$buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
117
110
$buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
118
111
$buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
119
-
120
112
Write-Host "Build flags: $($buildFlags -join ' | ')"
121
-
122
113
cmake --preset ${{ inputs.preset }} $buildFlags
123
114
124
- - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
115
+ # Loop over configs: Debug, Release, RelWithDebInfo
116
+ - name : Build ${{ inputs.game }} (Debug)
125
117
shell : pwsh
126
- run : |
127
- cmake --build --preset ${{ inputs.preset }}
118
+ run : cmake --build build/${{ inputs.preset }} --config Debug
128
119
129
- - name : Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
120
+ - name : Build ${{ inputs.game }} (Release)
130
121
shell : pwsh
131
- run : |
132
- $buildDir = "build\${{ inputs.preset }}"
133
- $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
122
+ run : cmake --build build/${{ inputs.preset }} --config Release
134
123
135
- if ("${{ inputs.preset }}" -like "win32*") {
136
- # For win32 preset, look in config-specific subdirectories
137
- $configToUse = if ("${{ inputs.preset }}" -match "debug") { "Debug" } else { "Release" }
138
- $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
139
- } else {
140
- $files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
141
- }
142
- $files | Move-Item -Destination $artifactsDir -Verbose -Force
124
+ - name : Build ${{ inputs.game }} (RelWithDebInfo)
125
+ shell : pwsh
126
+ run : cmake --build build/${{ inputs.preset }} --config RelWithDebInfo
143
127
144
- - name : Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
145
- uses : actions/upload-artifact@v4
146
- with :
147
- name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
148
- path : build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
149
- retention-days : 30
150
- if-no-files-found : error
128
+ # (Optional: Collect/Upload artifacts logic goes here if you want to keep per-config builds)
0 commit comments