Skip to content

Commit b1f1ae3

Browse files
authored
Add CI for generals and zerohour (#428)
Adds CI for generals and zerohour game executables using cmake vc6 preset Generals artifact containing generals executable Generals-Tools artifact containing generals tools executables GeneralsMD artifact containing zerohour executable GeneralsMD-Tools artifact containing zerohour tools executables
1 parent 8df197a commit b1f1ae3

File tree

4 files changed

+203
-0
lines changed

4 files changed

+203
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build Game with VC6
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
game:
7+
required: true
8+
type: string
9+
description: "Game to build (Generals or GeneralsMD)"
10+
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
timeout-minutes: 15
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Cache VC6 installation
20+
id: cache-vc6
21+
uses: actions/cache@v4
22+
with:
23+
path: C:\VC6
24+
key: vc6-permanent-cache-v1
25+
26+
- name: Cache CMake Dependencies
27+
id: cache-cmake-deps
28+
uses: actions/cache@v4
29+
with:
30+
path: build\vc6\_deps
31+
key: cmake-deps-${{ hashFiles('cmake/**/*.cmake', '**/CMakeLists.txt') }}
32+
restore-keys: |
33+
cmake-deps-
34+
35+
- name: Download VC6 Portable from Cloudflare R2
36+
if: steps.cache-vc6.outputs.cache-hit != 'true'
37+
env:
38+
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
39+
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
40+
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
41+
EXPECTED_HASH: "118D0F1ACBBD70C3F8B081CA4DBAF955FE0C6C359A76636E930AA89FDC551091"
42+
shell: pwsh
43+
run: |
44+
Write-Host "Downloading VC6 portable installation"
45+
aws s3 cp s3://github-ci/VS6_VisualStudio6.7z VS6_VisualStudio6.7z --endpoint-url $env:AWS_ENDPOINT_URL
46+
47+
Write-Host "Verifying file integrity..."
48+
$hash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
49+
Write-Host "Downloaded file SHA256: $hash"
50+
Write-Host "Expected SHA256: $env:EXPECTED_HASH"
51+
if ($hash -ne $env:EXPECTED_HASH) {
52+
Write-Error "Hash verification failed! File may be corrupted or tampered with."
53+
exit 1
54+
}
55+
56+
Write-Host "Extracting archive..."
57+
& 7z x VS6_VisualStudio6.7z -oC:\VC6
58+
59+
Write-Host "Cleaning up downloaded archive"
60+
Remove-Item VS6_VisualStudio6.7z
61+
62+
- name: Set up VC6 environment
63+
shell: pwsh
64+
run: |
65+
Write-Host "Setting up environment for using Microsoft Visual C++ tools"
66+
67+
# Define the base directories as local variables first
68+
$VSCommonDir = "C:\VC6\VC6SP6\Common"
69+
$MSDevDir = "C:\VC6\VC6SP6\Common\msdev98"
70+
$MSVCDir = "C:\VC6\VC6SP6\VC98"
71+
$VcOsDir = "WINNT"
72+
73+
# Set the variables in GitHub environment
74+
"VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV
75+
"MSDevDir=$MSDevDir" >> $env:GITHUB_ENV
76+
"MSVCDir=$MSVCDir" >> $env:GITHUB_ENV
77+
"VcOsDir=$VcOsDir" >> $env:GITHUB_ENV
78+
79+
# Set PATH
80+
"PATH=$MSDevDir\BIN;$MSVCDir\BIN;$VSCommonDir\TOOLS\$VcOsDir;$VSCommonDir\TOOLS;$env:PATH" >> $env:GITHUB_ENV
81+
82+
# Set INCLUDE
83+
"INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV
84+
85+
# Set LIB
86+
"LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
87+
88+
- name: Build with CMake using VC6 preset
89+
shell: pwsh
90+
run: |
91+
Write-Host "Configuring project with CMake using VC6 preset - building only ${{ inputs.game }}"
92+
93+
# Set build flags based on game
94+
if ("${{ inputs.game }}" -eq "Generals") {
95+
$buildFlags = @("-DGENZH_BUILD_ZEROHOUR=OFF", "-DGENZH_BUILD_GENERALS=ON", "-DGENZH_BUILD_GENERALS_TOOLS=ON")
96+
} else {
97+
$buildFlags = @("-DGENZH_BUILD_ZEROHOUR=ON", "-DGENZH_BUILD_GENERALS=OFF", "-DGENZH_BUILD_ZEROHOUR_TOOLS=ON")
98+
}
99+
100+
cmake --preset vc6 $buildFlags
101+
102+
Write-Host "Building project with CMake using VC6 preset - building only ${{ inputs.game }}"
103+
104+
$buildDir = "build/vc6"
105+
"buildDir=$buildDir" >> $env:GITHUB_ENV
106+
107+
cmake --build $buildDir
108+
109+
Write-Host "Collecting ${{ inputs.game }} tools"
110+
$toolsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\Tools"
111+
$files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}" -File | Where-Object { ($_.Extension -eq ".exe" -or $_.Extension -eq ".dll") -and $_.Name -ne "generals.exe" }
112+
$files | Move-Item -Destination $toolsDir
113+
114+
- name: Upload ${{ inputs.game }} executable
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: ${{ inputs.game }}
118+
path: ${{ env.buildDir }}/${{ inputs.game }}/generals.exe
119+
retention-days: 30
120+
if-no-files-found: error
121+
122+
- name: Upload ${{ inputs.game }} tools
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: ${{ inputs.game }}-Tools
126+
path: ${{ env.buildDir }}/${{ inputs.game }}/Tools
127+
retention-days: 30
128+
if-no-files-found: error
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Generals with VC6
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "Generals/**"
9+
- "Dependencies/**"
10+
- "cmake/**"
11+
- "CMakeLists.txt"
12+
- "CMakePresets.json"
13+
- ".github/workflows/build-vc6-generals.yml"
14+
- ".github/workflows/build-vc6-common.yml"
15+
pull_request:
16+
branches:
17+
- main
18+
paths:
19+
- "Generals/**"
20+
- "Dependencies/**"
21+
- "cmake/**"
22+
- "CMakeLists.txt"
23+
- "CMakePresets.json"
24+
- ".github/workflows/build-vc6-generals.yml"
25+
- ".github/workflows/build-vc6-common.yml"
26+
workflow_dispatch:
27+
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
30+
cancel-in-progress: true
31+
32+
jobs:
33+
generals:
34+
uses: ./.github/workflows/build-vc6-common.yml
35+
with:
36+
game: "Generals"
37+
secrets: inherit
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Zero Hour with VC6
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "GeneralsMD/**"
9+
- "Dependencies/**"
10+
- "cmake/**"
11+
- "CMakeLists.txt"
12+
- "CMakePresets.json"
13+
- ".github/workflows/build-vc6-zerohour.yml"
14+
- ".github/workflows/build-vc6-common.yml"
15+
pull_request:
16+
branches:
17+
- main
18+
paths:
19+
- "GeneralsMD/**"
20+
- "Dependencies/**"
21+
- "cmake/**"
22+
- "CMakeLists.txt"
23+
- "CMakePresets.json"
24+
- ".github/workflows/build-vc6-zerohour.yml"
25+
- ".github/workflows/build-vc6-common.yml"
26+
workflow_dispatch:
27+
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
30+
cancel-in-progress: true
31+
32+
jobs:
33+
zerohour:
34+
uses: ./.github/workflows/build-vc6-common.yml
35+
with:
36+
game: "GeneralsMD"
37+
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.*
33
!.gitignore
44
!.gitattributes
5+
!.github
56

67
*.user
78
*.ncb

0 commit comments

Comments
 (0)