11
11
required : true
12
12
type : string
13
13
description : " Game to build (Generals, GeneralsMD)"
14
- preset :
14
+ configurePreset :
15
15
required : true
16
16
type : string
17
- description : " CMake preset"
17
+ description : " CMake configure preset"
18
+ buildPreset :
19
+ required : true
20
+ type : string
21
+ description : " CMake build preset"
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 : Preset ${{ inputs.buildPreset }}${{ 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 : startsWith(inputs.buildPreset , 'vc6')
40
44
id : cache-vc6
41
45
uses : actions/cache@v4
42
46
with :
@@ -47,11 +51,11 @@ jobs:
47
51
id : cache-cmake-deps
48
52
uses : actions/cache@v4
49
53
with :
50
- path : build\${{ inputs.preset }}\_deps
51
- key : cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
54
+ path : build\${{ inputs.buildPreset }}\_deps
55
+ key : cmake-deps-${{ inputs.buildPreset }}-${{ 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 : ${{ startsWith(inputs.buildPreset , '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,39 +80,27 @@ 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 : startsWith(inputs.buildPreset , 'vc6')
80
84
shell : pwsh
81
85
run : |
82
- # Define the base directories as local variables first
83
- $VSCommonDir = "C:\VC6\VC6SP6\Common"
84
- $MSDevDir = "C:\VC6\VC6SP6\Common\msdev98"
85
- $MSVCDir = "C:\VC6\VC6SP6\VC98"
86
- $VcOsDir = "WINNT"
87
-
88
- # Set the variables in GitHub environment
89
- "VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV
90
- "MSDevDir=$MSDevDir" >> $env:GITHUB_ENV
91
- "MSVCDir=$MSVCDir" >> $env:GITHUB_ENV
92
- "VcOsDir=$VcOsDir" >> $env:GITHUB_ENV
93
- "PATH=$MSDevDir\BIN;$MSVCDir\BIN;$VSCommonDir\TOOLS\$VcOsDir;$VSCommonDir\TOOLS;$env:PATH" >> $env:GITHUB_ENV
94
- "INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV
95
- "LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
86
+ $VS6_DIR = "C:\VC6\VC6SP6"
87
+ "VS6_DIR=$VS6_DIR" >> $env:GITHUB_ENV
96
88
97
89
- name : Set Up VC2022 Environment
98
- if : startsWith(inputs.preset , 'win32')
90
+ if : ${{ ! startsWith(inputs.buildPreset , 'vc6') }}
99
91
uses : ilammy/msvc-dev-cmd@v1
100
92
with :
101
93
arch : x86
102
94
103
95
- name : Setup vcpkg
104
96
uses : lukka/run-vcpkg@v11
105
97
106
- - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
98
+ - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.configurePreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
107
99
shell : pwsh
108
100
run : |
109
101
$buildFlags = @(
110
- "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
111
- "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
102
+ "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
103
+ "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
112
104
)
113
105
114
106
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
@@ -119,32 +111,28 @@ jobs:
119
111
120
112
Write-Host "Build flags: $($buildFlags -join ' | ')"
121
113
122
- cmake --preset ${{ inputs.preset }} $buildFlags
114
+ cmake --preset ${{ inputs.configurePreset }} $buildFlags
123
115
124
- - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
116
+ - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
125
117
shell : pwsh
126
118
run : |
127
- cmake --build --preset ${{ inputs.preset }}
119
+ cmake --build --preset ${{ inputs.buildPreset }}
128
120
129
- - name : Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
121
+ - name : Collect ${{ inputs.game }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130
122
shell : pwsh
131
123
run : |
132
- $buildDir = "build\${{ inputs.preset }}"
124
+ $buildDir = "build\${{ inputs.configurePreset }}"
133
125
$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
- }
126
+ $configToUse = if ("${{ inputs.buildPreset }}" -match "relwithdebinfo") { "RelWithDebInfo" } elseif ("${{ inputs.buildPreset }}" -match "debug") { "Debug" } else { "Release" }
127
+ $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
142
128
$files | Move-Item -Destination $artifactsDir -Verbose -Force
143
129
144
- - name : Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130
+ - name : Upload ${{ inputs.game }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
145
131
uses : actions/upload-artifact@v4
146
132
with :
147
- name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
148
- path : build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
133
+ name : ${{ inputs.game }}-${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
134
+ path : build\${{ inputs.configurePreset }}\${{ inputs.game }}\artifacts
149
135
retention-days : 30
150
136
if-no-files-found : error
137
+
138
+
0 commit comments