Skip to content

Commit 24482ec

Browse files
committed
fix(ci): Move replay files to correct location, adjust exe call
1 parent 7c2b950 commit 24482ec

File tree

2 files changed

+17
-35
lines changed

2 files changed

+17
-35
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 25 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
@@ -165,39 +166,30 @@ jobs:
165166
with:
166167
name: GeneralsMD-${{ matrix.preset }}+t+e
167168
path: build
169+
- name: Move Replay files to correct folder
170+
shell: pwsh
171+
run: |
172+
$source = "GeneralsMD\Replays"
173+
$destination = "$env:USERPROFILE\Documents\Command and Conquer Generals Zero Hour\Replays"
174+
175+
New-Item -ItemType Directory -Path $destination -Force | Out-Null
176+
Get-ChildItem -Path $source -File | Move-Item -Destination $destination
168177
- name: Run Replay Compatibility Tests
169178
shell: pwsh
170179
run: |
171180
$exePath = "build\generalszh.exe"
172-
$replayPattern = "GeneralsMD\Replays\*.rep"
173-
$args = "-jobs", "2", "-headless", "-replay", "$replayPattern"
174181
175182
Write-Host "Checking if executable exists at: $exePath"
176183
if (-not (Test-Path $exePath)) {
177-
Write-Host "ERROR: Executable not found at $exePath"
178-
exit 1
179-
}
180-
181-
$commandLine = "$exePath $($args -join ' ')"
182-
Write-Host "Running: $commandLine"
183-
184-
try {
185-
& $exePath @args
186-
if (-not $?) {
187-
Write-Host "ERROR: Process failed to start or exited with an error."
184+
Write-Host "ERROR: Executable not found at $exePath"
188185
exit 1
189-
}
186+
}
190187
191-
$exitCode = $LASTEXITCODE
192-
if ($null -eq $exitCode) {
193-
Write-Host "WARNING: Process did not return an exit code. Assuming failure."
194-
exit 1
195-
}
188+
$process = Start-Process -FilePath $exePath -ArgumentList "-jobs 2 -headless" -Wait -PassThru
189+
$exitCode = $process.ExitCode
196190
197-
Write-Host "Process exited with code $exitCode"
198-
exit $exitCode
199-
} catch {
200-
Write-Host "ERROR: Exception occurred while running the process."
201-
Write-Host $_
202-
exit 1
191+
# Handle non-zero exit code
192+
if ($exitCode -ne 0) {
193+
Write-Host "Process failed with exit code $exitCode"
194+
throw "Executable failed with exit code $exitCode"
203195
}

GeneralsMD/Replays/replay_list.csv

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)