Skip to content

Commit e334e47

Browse files
committed
[GITHUB] Update CI to match new presets
1 parent 1589c55 commit e334e47

File tree

3 files changed

+36
-106
lines changed

3 files changed

+36
-106
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ on:
1414
preset:
1515
required: true
1616
type: string
17-
description: "CMake preset"
17+
description: "CMake configure preset"
18+
configuration:
19+
required: true
20+
type: string
21+
description: "Build configuration (Debug, Release, RelWithDebInfo)"
1822
tools:
1923
required: false
2024
default: true
@@ -28,15 +32,15 @@ on:
2832

2933
jobs:
3034
build:
31-
name: Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
35+
name: ${{ inputs.game }} ${{ inputs.preset }}-${{ inputs.configuration }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
3236
runs-on: windows-latest
3337
timeout-minutes: 40
3438
steps:
3539
- name: Checkout Code
3640
uses: actions/checkout@v4
3741

3842
- name: Cache VC6 Installation
39-
if: startsWith(inputs.preset, 'vc6')
43+
if: endsWith(inputs.preset, 'vc6')
4044
id: cache-vc6
4145
uses: actions/cache@v4
4246
with:
@@ -51,7 +55,7 @@ jobs:
5155
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
5256

5357
- name: Download VC6 Portable from Cloudflare R2
54-
if: ${{ startsWith(inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
58+
if: ${{ endsWith(inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
5559
env:
5660
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
5761
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
@@ -66,7 +70,7 @@ jobs:
6670
$fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash
6771
Write-Host "Downloaded file SHA256: $fileHash"
6872
Write-Host "Expected file SHA256: $env:EXPECTED_HASH"
69-
if ($hash -ne $env:EXPECTED_HASH) {
73+
if ($fileHash -ne $env:EXPECTED_HASH) {
7074
Write-Error "Hash verification failed! File may be corrupted or tampered with."
7175
exit 1
7276
}
@@ -76,16 +80,13 @@ jobs:
7680
Remove-Item VS6_VisualStudio6.7z -Verbose
7781
7882
- name: Set Up VC6 Environment
79-
if: startsWith(inputs.preset, 'vc6')
83+
if: endsWith(inputs.preset, 'vc6')
8084
shell: pwsh
8185
run: |
82-
# Define the base directories as local variables first
8386
$VSCommonDir = "C:\VC6\VC6SP6\Common"
8487
$MSDevDir = "C:\VC6\VC6SP6\Common\msdev98"
8588
$MSVCDir = "C:\VC6\VC6SP6\VC98"
8689
$VcOsDir = "WINNT"
87-
88-
# Set the variables in GitHub environment
8990
"VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV
9091
"MSDevDir=$MSDevDir" >> $env:GITHUB_ENV
9192
"MSVCDir=$MSVCDir" >> $env:GITHUB_ENV
@@ -95,56 +96,34 @@ jobs:
9596
"LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
9697
9798
- name: Set Up VC2022 Environment
98-
if: startsWith(inputs.preset, 'win32')
99+
if: ${{ !endsWith(inputs.preset, 'vc6') }}
99100
uses: ilammy/msvc-dev-cmd@v1
100101
with:
101102
arch: x86
102103

103-
- name: Setup vcpkg
104-
uses: lukka/run-vcpkg@v11
105-
106-
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
104+
- name: Configure (${{ inputs.preset }}, ${{ inputs.configuration }}) for ${{ inputs.game }}
107105
shell: pwsh
108106
run: |
109107
$buildFlags = @(
110-
"-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
111-
"-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
108+
"-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
109+
"-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
112110
)
113-
114111
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
115112
$buildFlags += "-DRTS_BUILD_CORE_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
116113
$buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}"
117114
$buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
118115
$buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
119-
120116
Write-Host "Build flags: $($buildFlags -join ' | ')"
121-
122117
cmake --preset ${{ inputs.preset }} $buildFlags
123-
124-
- name: Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
118+
119+
- name: Build ${{ inputs.game }} [${{ inputs.preset }} | ${{ inputs.configuration }}]
125120
shell: pwsh
126-
run: |
127-
cmake --build --preset ${{ inputs.preset }}
128-
129-
- name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130-
shell: pwsh
131-
run: |
132-
$buildDir = "build\${{ inputs.preset }}"
133-
$artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
134-
135-
if ("${{ inputs.preset }}" -like "win32*") {
136-
# For win32 preset, look in config-specific subdirectories
137-
$configToUse = if ("${{ inputs.preset }}" -match "debug") { "Debug" } else { "Release" }
138-
$files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
139-
} else {
140-
$files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
141-
}
142-
$files | Move-Item -Destination $artifactsDir -Verbose -Force
143-
144-
- name: Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
121+
run: cmake --build build/${{ inputs.preset }} --config ${{ inputs.configuration }}
122+
123+
- name: Upload Artifact | ${{ inputs.game }} | ${{ inputs.preset }} | ${{ inputs.configuration }}
145124
uses: actions/upload-artifact@v4
146125
with:
147-
name: ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
148-
path: build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
126+
name: "${{ inputs.game }} | ${{ inputs.preset }} | ${{ inputs.configuration }}"
127+
path: build\${{ inputs.preset }}\${{ inputs.game }}\${{ inputs.configuration }}\artifacts
149128
retention-days: 30
150129
if-no-files-found: error

.github/workflows/ci.yml

Lines changed: 13 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -57,89 +57,38 @@ jobs:
5757
echo "- Shared: ${{ steps.filter.outputs.shared == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
5858
5959
build-generals:
60-
name: Build Generals${{ matrix.preset && '' }}
60+
name: Build Generals${{ matrix.preset && '' }}-${{ matrix.configuration }}
6161
needs: detect-changes
6262
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
6363
strategy:
6464
matrix:
65-
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
75-
- preset: "win32"
76-
tools: true
77-
extras: true
78-
- preset: "win32-profile"
79-
tools: true
80-
extras: true
81-
- preset: "win32-debug"
82-
tools: true
83-
extras: true
84-
# vcpkg builds have been disabled for now due to excessive build times of 30 minutes per preset
85-
# - preset: "win32-vcpkg"
86-
# tools: true
87-
# extras: true
88-
# - preset: "win32-vcpkg-profile"
89-
# tools: true
90-
# extras: true
91-
# - preset: "win32-vcpkg-debug"
92-
# tools: true
93-
# extras: true
65+
preset: [ninja, ninja-vc6]
66+
configuration: [Debug, Release, RelWithDebInfo]
9467
fail-fast: false
9568
uses: ./.github/workflows/build-toolchain.yml
9669
with:
9770
game: "Generals"
9871
preset: ${{ matrix.preset }}
99-
tools: ${{ matrix.tools }}
100-
extras: ${{ matrix.extras }}
72+
configuration: ${{ matrix.configuration }}
73+
tools: true
74+
extras: true
10175
secrets: inherit
10276

10377
build-generalsmd:
104-
name: Build GeneralsMD${{ matrix.preset && '' }}
78+
name: Build GeneralsMD${{ matrix.preset && '' }}-${{ matrix.configuration }}
10579
needs: detect-changes
10680
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
10781
strategy:
10882
matrix:
109-
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
119-
- preset: "win32"
120-
tools: true
121-
extras: true
122-
- preset: "win32-profile"
123-
tools: true
124-
extras: true
125-
- preset: "win32-debug"
126-
tools: true
127-
extras: true
128-
# vcpkg builds have been disabled for now due to excessive build times of 30 minutes per preset
129-
# - preset: "win32-vcpkg"
130-
# tools: true
131-
# extras: true
132-
# - preset: "win32-vcpkg-profile"
133-
# tools: true
134-
# extras: true
135-
# - preset: "win32-vcpkg-debug"
136-
# tools: true
137-
# extras: true
83+
preset: [ninja, ninja-vc6]
84+
configuration: [Debug, Release, RelWithDebInfo]
13885
fail-fast: false
13986
uses: ./.github/workflows/build-toolchain.yml
14087
with:
14188
game: "GeneralsMD"
14289
preset: ${{ matrix.preset }}
143-
tools: ${{ matrix.tools }}
144-
extras: ${{ matrix.extras }}
90+
configuration: ${{ matrix.configuration }}
91+
tools: true
92+
extras: true
14593
secrets: inherit
94+

cmake/compilers.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ else()
4646
set(CMAKE_JOB_POOL_COMPILE compile)
4747
# and all link steps go into 'link' (so only one link ever runs since vc6 can't handle multithreaded linking)
4848
set(CMAKE_JOB_POOL_LINK link)
49+
# Needed to make vc6 compile with ninja
50+
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "")
4951
endif()
5052

5153
if(RTS_BUILD_OPTION_ASAN)

0 commit comments

Comments
 (0)