14
14
preset :
15
15
required : true
16
16
type : string
17
- description : " CMake preset"
17
+ description : " CMake configure preset"
18
+ configuration :
19
+ required : true
20
+ type : string
21
+ description : " Build configuration (Debug, Release, RelWithDebInfo)"
18
22
tools :
19
23
required : false
20
24
default : true
28
32
29
33
jobs :
30
34
build :
31
- name : Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
35
+ name : ${{ inputs.game }} ${{ inputs.preset }}-${{ inputs.configuration }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
32
36
runs-on : windows-latest
33
37
timeout-minutes : 40
34
38
steps :
35
39
- name : Checkout Code
36
40
uses : actions/checkout@v4
37
41
38
42
- name : Cache VC6 Installation
39
- if : startsWith (inputs.preset, 'vc6')
43
+ if : endsWith (inputs.preset, 'vc6')
40
44
id : cache-vc6
41
45
uses : actions/cache@v4
42
46
with :
51
55
key : cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
52
56
53
57
- name : Download VC6 Portable from Cloudflare R2
54
- if : ${{ startsWith (inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
58
+ if : ${{ endsWith (inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
55
59
env :
56
60
AWS_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
57
61
AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
66
70
$fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
67
71
Write-Host "Downloaded file SHA256: $fileHash"
68
72
Write-Host "Expected file SHA256: $env:EXPECTED_HASH"
69
- if ($hash -ne $env:EXPECTED_HASH) {
73
+ if ($fileHash -ne $env:EXPECTED_HASH) {
70
74
Write-Error "Hash verification failed! File may be corrupted or tampered with."
71
75
exit 1
72
76
}
@@ -76,16 +80,13 @@ jobs:
76
80
Remove-Item VS6_VisualStudio6.7z -Verbose
77
81
78
82
- name : Set Up VC6 Environment
79
- if : startsWith (inputs.preset, 'vc6')
83
+ if : endsWith (inputs.preset, 'vc6')
80
84
shell : pwsh
81
85
run : |
82
- # Define the base directories as local variables first
83
86
$VSCommonDir = "C:\VC6\VC6SP6\Common"
84
87
$MSDevDir = "C:\VC6\VC6SP6\Common\msdev98"
85
88
$MSVCDir = "C:\VC6\VC6SP6\VC98"
86
89
$VcOsDir = "WINNT"
87
-
88
- # Set the variables in GitHub environment
89
90
"VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV
90
91
"MSDevDir=$MSDevDir" >> $env:GITHUB_ENV
91
92
"MSVCDir=$MSVCDir" >> $env:GITHUB_ENV
@@ -95,56 +96,34 @@ jobs:
95
96
"LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
96
97
97
98
- name : Set Up VC2022 Environment
98
- if : startsWith (inputs.preset, 'win32')
99
+ if : ${{ !endsWith (inputs.preset, 'vc6') }}
99
100
uses : ilammy/msvc-dev-cmd@v1
100
101
with :
101
102
arch : x86
102
103
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
104
+ - name : Configure (${{ inputs.preset }}, ${{ inputs.configuration }}) for ${{ inputs.game }}
107
105
shell : pwsh
108
106
run : |
109
107
$buildFlags = @(
110
- "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
111
- "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
108
+ "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
109
+ "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
112
110
)
113
-
114
111
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
115
112
$buildFlags += "-DRTS_BUILD_CORE_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
116
113
$buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
117
114
$buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
118
115
$buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
119
-
120
116
Write-Host "Build flags: $($buildFlags -join ' | ')"
121
-
122
117
cmake --preset ${{ inputs.preset }} $buildFlags
123
-
124
- - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }} ${{ inputs.extras && '+e' || '' }} Preset
118
+
119
+ - name : Build ${{ inputs.game }} [ ${{ inputs.preset }} | ${{ inputs.configuration }}]
125
120
shell : pwsh
126
- run : |
127
- cmake --build --preset ${{ inputs.preset }}
128
-
129
- - name : Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130
- shell : pwsh
131
- run : |
132
- $buildDir = "build\${{ inputs.preset }}"
133
- $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
134
-
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
143
-
144
- - name : Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
121
+ run : cmake --build build/${{ inputs.preset }} --config ${{ inputs.configuration }}
122
+
123
+ - name : Upload Artifact | ${{ inputs.game }} | ${{ inputs.preset }} | ${{ inputs.configuration }}
145
124
uses : actions/upload-artifact@v4
146
125
with :
147
- name : ${{ inputs.game }}- ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }} ${{ inputs.extras && '+e' || '' }}
148
- path : build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
126
+ name : " ${{ inputs.game }} | ${{ inputs.preset }} | ${{ inputs.configuration }} "
127
+ path : build\${{ inputs.preset }}\${{ inputs.game }}\${{ inputs.configuration }}\ artifacts
149
128
retention-days : 30
150
129
if-no-files-found : error
0 commit comments