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,29 +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
86
$VS6_DIR = "C:\VC6\VC6SP6"
84
- # Set the variables in GitHub environment
85
87
"VS6_DIR=$VS6_DIR" >> $env:GITHUB_ENV
86
88
87
89
- name : Set Up VC2022 Environment
88
- if : ${{ !startsWith(inputs.preset , 'vc6') }}
90
+ if : ${{ !startsWith(inputs.buildPreset , 'vc6') }}
89
91
uses : ilammy/msvc-dev-cmd@v1
90
92
with :
91
93
arch : x86
92
94
93
95
- name : Setup vcpkg
94
96
uses : lukka/run-vcpkg@v11
95
97
96
- - 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
97
99
shell : pwsh
98
100
run : |
99
101
$buildFlags = @(
100
- "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
101
- "-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' }}"
102
104
)
103
105
104
106
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
@@ -109,27 +111,28 @@ jobs:
109
111
110
112
Write-Host "Build flags: $($buildFlags -join ' | ')"
111
113
112
- cmake --preset ${{ inputs.preset }} $buildFlags
114
+ cmake --preset ${{ inputs.configurePreset }} $buildFlags
113
115
114
- - 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
115
117
shell : pwsh
116
118
run : |
117
- cmake --build --preset ${{ inputs.preset }}
119
+ cmake --build --preset ${{ inputs.buildPreset }}
118
120
119
- - 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
120
122
shell : pwsh
121
123
run : |
122
- $buildDir = "build\${{ inputs.preset }}"
124
+ $buildDir = "build\${{ inputs.configurePreset }}"
123
125
$artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
124
- # look in config-specific subdirectories
125
- $configToUse = if ("${{ inputs.preset }}" -match "relwithdebinfo") { "RelWithDebInfo" } else { "Release" }
126
- $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
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
127
128
$files | Move-Item -Destination $artifactsDir -Verbose -Force
128
129
129
- - 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
130
131
uses : actions/upload-artifact@v4
131
132
with :
132
- name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
133
- 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
134
135
retention-days : 30
135
136
if-no-files-found : error
137
+
138
+
0 commit comments