Skip to content

Commit fa996eb

Browse files
authored
[GitHub] Add CI for VS2022 (#531)
This PR adds CI for VS2022 builds and enables the gated EXTRAS for VC6 as well. Renamed build-games.yml simply to ci.yml for future addition of linters.
1 parent 1e1d5dd commit fa996eb

File tree

5 files changed

+190
-130
lines changed

5 files changed

+190
-130
lines changed

.github/workflows/build-games.yml

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

.github/workflows/toolchain-common.yml renamed to .github/workflows/build-toolchain.yml

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Common Toolchain
1+
name: Build Toolchain
22

33
permissions:
44
contents: read
@@ -16,19 +16,26 @@ on:
1616
type: string
1717
description: "CMake preset"
1818
tools:
19-
default: false
19+
required: false
20+
default: true
2021
type: boolean
2122
description: "Build tools"
23+
extras:
24+
required: false
25+
default: false
26+
type: boolean
27+
description: "Build extras"
2228

2329
jobs:
2430
build:
31+
name: Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
2532
runs-on: windows-latest
2633
timeout-minutes: 20
2734
steps:
28-
- name: Checkout code
35+
- name: Checkout Code
2936
uses: actions/checkout@v4
3037

31-
- name: Cache VC6 installation
38+
- name: Cache VC6 Installation
3239
if: startsWith(inputs.preset, 'vc6')
3340
id: cache-vc6
3441
uses: actions/cache@v4
@@ -54,24 +61,23 @@ jobs:
5461
EXPECTED_HASH: "118D0F1ACBBD70C3F8B081CA4DBAF955FE0C6C359A76636E930AA89FDC551091"
5562
shell: pwsh
5663
run: |
57-
Write-Host "Downloading VC6 portable installation"
64+
Write-Host "Downloading VC6 Portable Installation" -ForegroundColor Cyan
5865
aws s3 cp s3://github-ci/VS6_VisualStudio6.7z VS6_VisualStudio6.7z --endpoint-url $env:AWS_ENDPOINT_URL
5966
60-
Write-Host "Verifying file integrity..."
61-
$hash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
62-
Write-Host "Downloaded file SHA256: $hash"
63-
Write-Host "Expected SHA256: $env:EXPECTED_HASH"
67+
Write-Host "Verifying File Integrity" -ForegroundColor Cyan
68+
$fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
69+
Write-Host "Downloaded file SHA256: $fileHash"
70+
Write-Host "Expected file SHA256: $env:EXPECTED_HASH"
6471
if ($hash -ne $env:EXPECTED_HASH) {
6572
Write-Error "Hash verification failed! File may be corrupted or tampered with."
6673
exit 1
6774
}
6875
69-
Write-Host "Extracting archive..."
76+
Write-Host "Extracting Archive" -ForegroundColor Cyan
7077
& 7z x VS6_VisualStudio6.7z -oC:\VC6
71-
7278
Remove-Item VS6_VisualStudio6.7z -Verbose
7379
74-
- name: Set up VC6 environment
80+
- name: Set Up VC6 Environment
7581
if: startsWith(inputs.preset, 'vc6')
7682
shell: pwsh
7783
run: |
@@ -90,43 +96,52 @@ jobs:
9096
"INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV
9197
"LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
9298
93-
- name: Build ${{ inputs.game }} with CMake using ${{ inputs.preset }} preset
99+
- name: Set Up VC2022 Environment
100+
if: startsWith(inputs.preset, 'win32')
101+
uses: ilammy/msvc-dev-cmd@v1
102+
with:
103+
arch: x86
104+
105+
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
94106
shell: pwsh
95107
run: |
96-
Write-Host "Configuring project with CMake using preset: ${{ inputs.game }} (${{ inputs.preset }})"
97-
98-
# Set build flags based on game and tools
99-
if ("${{ inputs.game }}" -eq "Generals") {
100-
$buildFlags = @("-DGENZH_BUILD_ZEROHOUR=OFF", "-DGENZH_BUILD_GENERALS=ON")
101-
if ("${{ inputs.tools }}" -eq "true") {
102-
$buildFlags += "-DGENZH_BUILD_GENERALS_TOOLS=ON"
103-
$buildFlags += "-DGENZH_BUILD_GENERALS_EXTRAS=ON"
104-
}
105-
} else {
106-
$buildFlags = @("-DGENZH_BUILD_ZEROHOUR=ON", "-DGENZH_BUILD_GENERALS=OFF")
107-
if ("${{ inputs.tools }}" -eq "true") {
108-
$buildFlags += "-DGENZH_BUILD_ZEROHOUR_TOOLS=ON"
109-
$buildFlags += "-DGENZH_BUILD_ZEROHOUR_EXTRAS=ON"
110-
}
111-
}
108+
$buildFlags = @(
109+
"-DGENZH_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
110+
"-DGENZH_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
111+
)
112112
113-
cmake --preset ${{ inputs.preset }} $buildFlags
113+
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
114+
$buildFlags += "-DGENZH_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
115+
$buildFlags += "-DGENZH_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
114116
115-
Write-Host "Building project with CMake using preset: ${{ inputs.game }} (${{ inputs.preset }})"
117+
Write-Host "Build flags: $buildFlags"
116118
117-
$buildDir = "build\${{ inputs.preset }}"
119+
cmake --preset ${{ inputs.preset }} $buildFlags
118120
119-
cmake --build $buildDir
121+
- name: Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
122+
shell: pwsh
123+
run: |
124+
cmake --build --preset ${{ inputs.preset }}
120125
121-
Write-Host "Collecting ${{ inputs.game }} artifacts"
126+
- name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
127+
shell: pwsh
128+
run: |
129+
$buildDir = "build\${{ inputs.preset }}"
122130
$artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
123-
$files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
131+
132+
if ("${{ inputs.preset }}" -like "win32*") {
133+
# For win32 preset, look in config-specific subdirectories
134+
$configToUse = if ("${{ inputs.preset }}" -eq "win32dbg") { "Debug" } else { "Release" }
135+
$files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
136+
} else {
137+
$files = Get-ChildItem -Path "$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
138+
}
124139
$files | Move-Item -Destination $artifactsDir -Verbose
125140
126-
- name: Upload ${{ inputs.game }} (${{ inputs.preset }}) artifact
141+
- name: Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
127142
uses: actions/upload-artifact@v4
128143
with:
129-
name: ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools == true && '+tools' || '' }}
144+
name: ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
130145
path: build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
131146
retention-days: 30
132147
if-no-files-found: error

.github/workflows/ci.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: GenCI
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
branches:
13+
- main
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
detect-changes:
22+
name: Detect File Changes
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 5
25+
outputs:
26+
generals: ${{ steps.filter.outputs.generals }}
27+
generalsmd: ${{ steps.filter.outputs.generalsmd }}
28+
shared: ${{ steps.filter.outputs.shared }}
29+
steps:
30+
- name: Checkout Code
31+
uses: actions/checkout@v4
32+
33+
- name: Filter Changed Paths
34+
uses: dorny/paths-filter@v3
35+
id: filter
36+
with:
37+
token: ''
38+
filters: |
39+
generals:
40+
- 'Generals/**'
41+
generalsmd:
42+
- 'GeneralsMD/**'
43+
shared:
44+
- 'Dependencies/**'
45+
- 'cmake/**'
46+
- 'CMakeLists.txt'
47+
- 'CMakePresets.json'
48+
- ".github/workflows/ci.yml"
49+
- '.github/workflows/build-toolchain.yml'
50+
51+
- name: Changes Summary
52+
run: |
53+
echo "### 🔍 File Changes Summary" >> $GITHUB_STEP_SUMMARY
54+
echo "- Generals: ${{ steps.filter.outputs.generals == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
55+
echo "- GeneralsMD: ${{ steps.filter.outputs.generalsmd == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
56+
echo "- Shared: ${{ steps.filter.outputs.shared == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
57+
58+
build-generals:
59+
name: Build Generals${{ matrix.preset && '' }}
60+
needs: detect-changes
61+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
62+
strategy:
63+
matrix:
64+
include:
65+
- preset: "vc6"
66+
tools: true
67+
extras: true
68+
- preset: "vc6prof"
69+
tools: true
70+
extras: true
71+
- preset: "vc6int"
72+
tools: true
73+
extras: true
74+
- preset: "vc6dbg"
75+
tools: true
76+
extras: true
77+
- preset: "win32"
78+
tools: true
79+
extras: true
80+
- preset: "win32prof"
81+
tools: true
82+
extras: true
83+
- preset: "win32int"
84+
tools: true
85+
extras: true
86+
- preset: "win32dbg"
87+
tools: true
88+
extras: true
89+
fail-fast: false
90+
uses: ./.github/workflows/build-toolchain.yml
91+
with:
92+
game: "Generals"
93+
preset: ${{ matrix.preset }}
94+
tools: ${{ matrix.tools }}
95+
extras: ${{ matrix.extras }}
96+
secrets: inherit
97+
98+
build-generalsmd:
99+
name: Build GeneralsMD${{ matrix.preset && '' }}
100+
needs: detect-changes
101+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
102+
strategy:
103+
matrix:
104+
include:
105+
- preset: "vc6"
106+
tools: true
107+
extras: true
108+
- preset: "vc6prof"
109+
tools: true
110+
extras: true
111+
- preset: "vc6int"
112+
tools: true
113+
extras: true
114+
- preset: "vc6dbg"
115+
tools: true
116+
extras: true
117+
- preset: "win32"
118+
tools: true
119+
extras: true
120+
- preset: "win32prof"
121+
tools: true
122+
extras: true
123+
- preset: "win32int"
124+
tools: true
125+
extras: true
126+
- preset: "win32dbg"
127+
tools: true
128+
extras: true
129+
fail-fast: false
130+
uses: ./.github/workflows/build-toolchain.yml
131+
with:
132+
game: "GeneralsMD"
133+
preset: ${{ matrix.preset }}
134+
tools: ${{ matrix.tools }}
135+
extras: ${{ matrix.extras }}
136+
secrets: inherit

Generals/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ endif()
3535
if(GENZH_GENERALS_INSTALL_PREFIX AND NOT "${GENZH_GENERALS_INSTALL_PREFIX}" STREQUAL "/registry")
3636
install(TARGETS g_generals RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
3737
install(FILES $<TARGET_PDB_FILE:g_generals> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
38-
38+
3939
if(TARGET g_worldbuilder)
4040
install(TARGETS g_worldbuilder RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
4141
install(FILES $<TARGET_PDB_FILE:g_worldbuilder> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)

GeneralsMD/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif()
3434
if(GENZH_ZEROHOUR_INSTALL_PREFIX AND NOT "${GENZH_ZEROHOUR_INSTALL_PREFIX}" STREQUAL "/registry")
3535
install(TARGETS z_generals RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
3636
install(FILES $<TARGET_PDB_FILE:z_generals> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
37-
37+
3838
if(TARGET z_worldbuilder)
3939
install(TARGETS z_worldbuilder RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
4040
install(FILES $<TARGET_PDB_FILE:z_worldbuilder> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)

0 commit comments

Comments
 (0)