Skip to content

Commit 6cad884

Browse files
committed
feat(ci): validate replays for mismatches
1 parent d8af372 commit 6cad884

13 files changed

+127
-21
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ jobs:
126126
run: |
127127
cmake --build --preset ${{ inputs.preset }}
128128
129+
- name: Scout
130+
shell: pwsh
131+
run: |
132+
Get-ChildItem -Directory | ForEach-Object {
133+
Write-Host "`n$($_.FullName):" -ForegroundColor Cyan
134+
Get-ChildItem $_.FullName | Format-Table Mode, LastWriteTime, Length, Name -AutoSize
135+
}
136+
129137
- name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130138
shell: pwsh
131139
run: |

.github/workflows/ci.yml

Lines changed: 79 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- main
11+
- ci-replays
1112
pull_request:
1213
branches:
1314
- main
@@ -41,8 +42,7 @@ jobs:
4142
generalsmd:
4243
- 'GeneralsMD/**'
4344
shared:
44-
- '.github/workflows/build-toolchain.yml'
45-
- '.github/workflows/ci.yml'
45+
- '.github/workflows/**'
4646
- 'CMakeLists.txt'
4747
- 'CMakePresets.json'
4848
- 'cmake/**'
@@ -63,15 +63,15 @@ jobs:
6363
strategy:
6464
matrix:
6565
include:
66-
- preset: "vc6"
67-
tools: true
68-
extras: true
69-
- preset: "vc6-profile"
70-
tools: true
71-
extras: true
72-
- preset: "vc6-debug"
73-
tools: true
74-
extras: true
66+
# - preset: "vc6"
67+
# tools: true
68+
# extras: true
69+
# - preset: "vc6-profile"
70+
# tools: true
71+
# extras: true
72+
# - preset: "vc6-debug"
73+
# tools: true
74+
# extras: true
7575
- preset: "win32"
7676
tools: true
7777
extras: true
@@ -107,15 +107,15 @@ jobs:
107107
strategy:
108108
matrix:
109109
include:
110-
- preset: "vc6"
111-
tools: true
112-
extras: true
113-
- preset: "vc6-profile"
114-
tools: true
115-
extras: true
116-
- preset: "vc6-debug"
117-
tools: true
118-
extras: true
110+
# - preset: "vc6"
111+
# tools: true
112+
# extras: true
113+
# - preset: "vc6-profile"
114+
# tools: true
115+
# extras: true
116+
# - preset: "vc6-debug"
117+
# tools: true
118+
# extras: true
119119
- preset: "win32"
120120
tools: true
121121
extras: true
@@ -125,6 +125,9 @@ jobs:
125125
- preset: "win32-debug"
126126
tools: true
127127
extras: true
128+
- preset: "win32-debuglog"
129+
tools: true
130+
extras: true
128131
# vcpkg builds have been disabled for now due to excessive build times of 30 minutes per preset
129132
# - preset: "win32-vcpkg"
130133
# tools: true
@@ -143,3 +146,59 @@ jobs:
143146
tools: ${{ matrix.tools }}
144147
extras: ${{ matrix.extras }}
145148
secrets: inherit
149+
150+
replay-test:
151+
name: Replay Compatibility Test${{ matrix.preset && '' }}
152+
needs: build-generalsmd
153+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
154+
runs-on: windows-latest
155+
strategy:
156+
matrix:
157+
include:
158+
- preset: "win32"
159+
- preset: "win32-profile"
160+
- preset: "win32-debug"
161+
steps:
162+
- name: Checkout Code
163+
uses: actions/checkout@v4
164+
- name: Download Game Artifact
165+
uses: actions/download-artifact@v4
166+
with:
167+
name: GeneralsMD-${{ matrix.preset }}+t+e
168+
path: build
169+
- name: Run Replay Compatibility Tests
170+
shell: pwsh
171+
run: |
172+
$exePath = "build\generalszh.exe"
173+
$replayPattern = "GeneralsMD\Replays\*.rep"
174+
$args = "-jobs", "2", "-headless", "-replay", "$replayPattern"
175+
176+
Write-Host "Checking if executable exists at: $exePath"
177+
if (-not (Test-Path $exePath)) {
178+
Write-Host "ERROR: Executable not found at $exePath"
179+
exit 1
180+
}
181+
182+
$commandLine = "$exePath $($args -join ' ')"
183+
Write-Host "Running: $commandLine"
184+
185+
try {
186+
& $exePath @args
187+
if (-not $?) {
188+
Write-Host "ERROR: Process failed to start or exited with an error."
189+
exit 1
190+
}
191+
192+
$exitCode = $LASTEXITCODE
193+
if ($null -eq $exitCode) {
194+
Write-Host "WARNING: Process did not return an exit code. Assuming failure."
195+
exit 1
196+
}
197+
198+
Write-Host "Process exited with code $exitCode"
199+
exit $exitCode
200+
} catch {
201+
Write-Host "ERROR: Exception occurred while running the process."
202+
Write-Host $_
203+
exit 1
204+
}

CMakePresets.json

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@
119119
"RTS_BUILD_OPTION_DEBUG": "ON"
120120
}
121121
},
122+
{
123+
"name": "win32-debuglog",
124+
"inherits": "win32",
125+
"displayName": "Windows 32bit Debug Logging",
126+
"cacheVariables": {
127+
"RTS_DEBUG_LOGGING": "ON",
128+
"RTS_DEBUG_CRASHING": "ON"
129+
}
130+
},
122131
{
123132
"name": "win32-vcpkg",
124133
"inherits": "default-vcpkg",
@@ -221,6 +230,13 @@
221230
"description": "Build Windows 32bit Debug",
222231
"configuration": "Debug"
223232
},
233+
{
234+
"name": "win32-debuglog",
235+
"configurePreset": "win32-debuglog",
236+
"displayName": "Build Windows 32bit Debug Logging",
237+
"description": "Build Windows 32bit Debug Logging",
238+
"configuration": "Debug"
239+
},
224240
{
225241
"name": "win32-vcpkg",
226242
"configurePreset": "win32-vcpkg",
@@ -362,6 +378,19 @@
362378
}
363379
]
364380
},
381+
{
382+
"name": "win32-debuglog",
383+
"steps": [
384+
{
385+
"type": "configure",
386+
"name": "win32-debuglog"
387+
},
388+
{
389+
"type": "build",
390+
"name": "win32-debuglog"
391+
}
392+
]
393+
},
365394
{
366395
"name": "win32-vcpkg",
367396
"steps": [
@@ -428,4 +457,4 @@
428457
]
429458
}
430459
]
431-
}
460+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)