Skip to content

[GITHUB][ZH] Validate replays for mismatches in CI #1239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 70 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- main
- ci-replays
pull_request:
branches:
- main
Expand Down Expand Up @@ -41,8 +42,7 @@ jobs:
generalsmd:
- 'GeneralsMD/**'
shared:
- '.github/workflows/build-toolchain.yml'
- '.github/workflows/ci.yml'
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'cmake/**'
Expand All @@ -63,15 +63,15 @@ jobs:
strategy:
matrix:
include:
- preset: "vc6"
tools: true
extras: true
- preset: "vc6-profile"
tools: true
extras: true
- preset: "vc6-debug"
tools: true
extras: true
# - preset: "vc6"
# tools: true
# extras: true
# - preset: "vc6-profile"
# tools: true
# extras: true
# - preset: "vc6-debug"
# tools: true
# extras: true
- preset: "win32"
tools: true
extras: true
Expand Down Expand Up @@ -107,15 +107,15 @@ jobs:
strategy:
matrix:
include:
- preset: "vc6"
tools: true
extras: true
- preset: "vc6-profile"
tools: true
extras: true
- preset: "vc6-debug"
tools: true
extras: true
# - preset: "vc6"
# tools: true
# extras: true
# - preset: "vc6-profile"
# tools: true
# extras: true
# - preset: "vc6-debug"
# tools: true
# extras: true
- preset: "win32"
tools: true
extras: true
Expand All @@ -125,6 +125,9 @@ jobs:
- preset: "win32-debug"
tools: true
extras: true
- preset: "win32-debuglog"
tools: true
extras: true
# vcpkg builds have been disabled for now due to excessive build times of 30 minutes per preset
# - preset: "win32-vcpkg"
# tools: true
Expand All @@ -143,3 +146,50 @@ jobs:
tools: ${{ matrix.tools }}
extras: ${{ matrix.extras }}
secrets: inherit

replay-test:
name: Replay Compatibility Test${{ matrix.preset && '' }}
needs: build-generalsmd
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
runs-on: windows-latest
strategy:
matrix:
include:
- preset: "win32"
- preset: "win32-profile"
- preset: "win32-debug"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Game Artifact
uses: actions/download-artifact@v4
with:
name: GeneralsMD-${{ matrix.preset }}+t+e
path: build
- name: Move Replay files to correct folder
shell: pwsh
run: |
$source = "GeneralsMD\Replays"
$destination = "$env:USERPROFILE\Documents\Command and Conquer Generals Zero Hour\Replays"

New-Item -ItemType Directory -Path $destination -Force | Out-Null
Get-ChildItem -Path $source -File | Move-Item -Destination $destination
- name: Run Replay Compatibility Tests
shell: pwsh
run: |
$exePath = "build\generalszh.exe"

Write-Host "Checking if executable exists at: $exePath"
if (-not (Test-Path $exePath)) {
Write-Host "ERROR: Executable not found at $exePath"
exit 1
}

$process = Start-Process -FilePath $exePath -ArgumentList "-jobs 2 -headless -replay *.rep" -Wait -PassThru
$exitCode = $process.ExitCode

# Handle non-zero exit code
if ($exitCode -ne 0) {
Write-Host "Process failed with exit code $exitCode"
throw "Executable failed with exit code $exitCode"
}
31 changes: 30 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@
"RTS_BUILD_OPTION_DEBUG": "ON"
}
},
{
"name": "win32-debuglog",
"inherits": "win32",
"displayName": "Windows 32bit Debug Logging",
"cacheVariables": {
"RTS_DEBUG_LOGGING": "ON",
"RTS_DEBUG_CRASHING": "ON"
}
},
{
"name": "win32-vcpkg",
"inherits": "default-vcpkg",
Expand Down Expand Up @@ -221,6 +230,13 @@
"description": "Build Windows 32bit Debug",
"configuration": "Debug"
},
{
"name": "win32-debuglog",
"configurePreset": "win32-debuglog",
"displayName": "Build Windows 32bit Debug Logging",
"description": "Build Windows 32bit Debug Logging",
"configuration": "Debug"
},
{
"name": "win32-vcpkg",
"configurePreset": "win32-vcpkg",
Expand Down Expand Up @@ -362,6 +378,19 @@
}
]
},
{
"name": "win32-debuglog",
"steps": [
{
"type": "configure",
"name": "win32-debuglog"
},
{
"type": "build",
"name": "win32-debuglog"
}
]
},
{
"name": "win32-vcpkg",
"steps": [
Expand Down Expand Up @@ -428,4 +457,4 @@
]
}
]
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added GeneralsMD/Replays/366648.rep
Binary file not shown.
Binary file added GeneralsMD/Replays/Golden Replay #1.rep
Binary file not shown.
Loading