Skip to content

Commit a6b85ab

Browse files
committed
fix ci
2 parents 9308959 + fef5251 commit a6b85ab

File tree

2 files changed

+67
-46
lines changed

2 files changed

+67
-46
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ on:
1111
required: true
1212
type: string
1313
description: "Game to build (Generals, GeneralsMD)"
14-
preset:
14+
configurePreset:
1515
required: true
1616
type: string
17-
description: "CMake preset"
17+
description: "CMake configure preset"
18+
buildPreset:
19+
required: true
20+
type: string
21+
description: "CMake build preset"
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: Preset ${{ inputs.buildPreset }}${{ 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: startsWith(inputs.buildPreset, 'vc6')
4044
id: cache-vc6
4145
uses: actions/cache@v4
4246
with:
@@ -47,11 +51,11 @@ jobs:
4751
id: cache-cmake-deps
4852
uses: actions/cache@v4
4953
with:
50-
path: build\${{ inputs.preset }}\_deps
51-
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
54+
path: build\${{ inputs.buildPreset }}\_deps
55+
key: cmake-deps-${{ inputs.buildPreset }}-${{ 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: ${{ startsWith(inputs.buildPreset, '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,29 +80,27 @@ jobs:
7680
Remove-Item VS6_VisualStudio6.7z -Verbose
7781
7882
- name: Set Up VC6 Environment
79-
if: startsWith(inputs.preset, 'vc6')
83+
if: startsWith(inputs.buildPreset, 'vc6')
8084
shell: pwsh
8185
run: |
82-
# Define the base directories as local variables first
8386
$VS6_DIR = "C:\VC6\VC6SP6"
84-
# Set the variables in GitHub environment
8587
"VS6_DIR=$VS6_DIR" >> $env:GITHUB_ENV
8688
8789
- name: Set Up VC2022 Environment
88-
if: ${{ !startsWith(inputs.preset, 'vc6') }}
90+
if: ${{ !startsWith(inputs.buildPreset, 'vc6') }}
8991
uses: ilammy/msvc-dev-cmd@v1
9092
with:
9193
arch: x86
9294

9395
- name: Setup vcpkg
9496
uses: lukka/run-vcpkg@v11
9597

96-
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
98+
- name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.configurePreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
9799
shell: pwsh
98100
run: |
99101
$buildFlags = @(
100-
"-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
101-
"-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
102+
"-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
103+
"-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
102104
)
103105
104106
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
@@ -109,27 +111,28 @@ jobs:
109111
110112
Write-Host "Build flags: $($buildFlags -join ' | ')"
111113
112-
cmake --preset ${{ inputs.preset }} $buildFlags
114+
cmake --preset ${{ inputs.configurePreset }} $buildFlags
113115
114-
- name: Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
116+
- name: Build ${{ inputs.game }} with CMake Using ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
115117
shell: pwsh
116118
run: |
117-
cmake --build --preset ${{ inputs.preset }}
119+
cmake --build --preset ${{ inputs.buildPreset }}
118120
119-
- name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
121+
- name: Collect ${{ inputs.game }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
120122
shell: pwsh
121123
run: |
122-
$buildDir = "build\${{ inputs.preset }}"
124+
$buildDir = "build\${{ inputs.configurePreset }}"
123125
$artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
124-
# look in config-specific subdirectories
125-
$configToUse = if ("${{ inputs.preset }}" -match "relwithdebinfo") { "RelWithDebInfo" } else { "Release" }
126-
$files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
126+
$configToUse = if ("${{ inputs.buildPreset }}" -match "relwithdebinfo") { "RelWithDebInfo" } elseif ("${{ inputs.buildPreset }}" -match "debug") { "Debug" } else { "Release" }
127+
$files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
127128
$files | Move-Item -Destination $artifactsDir -Verbose -Force
128129
129-
- name: Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130+
- name: Upload ${{ inputs.game }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130131
uses: actions/upload-artifact@v4
131132
with:
132-
name: ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
133-
path: build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
133+
name: ${{ inputs.game }}-${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
134+
path: build\${{ inputs.configurePreset }}\${{ inputs.game }}\artifacts
134135
retention-days: 30
135136
if-no-files-found: error
137+
138+

.github/workflows/ci.yml

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,81 +57,99 @@ 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.configurePreset }} | ${{ matrix.buildPreset }})
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:
6565
include:
66-
- preset: "release"
66+
- configurePreset: "default"
67+
buildPreset: "release"
6768
tools: true
6869
extras: true
69-
- preset: "relwithdebinfo"
70+
- configurePreset: "default"
71+
buildPreset: "relwithdebinfo"
7072
tools: true
7173
extras: true
72-
- preset: "dev-release"
74+
- configurePreset: "dev"
75+
buildPreset: "dev-release"
7376
tools: true
7477
extras: true
75-
- preset: "dev-relwithdebinfo"
78+
- configurePreset: "dev"
79+
buildPreset: "dev-relwithdebinfo"
7680
tools: true
7781
extras: true
78-
- preset: "vc6-release"
82+
- configurePreset: "vc6"
83+
buildPreset: "vc6-release"
7984
tools: true
8085
extras: true
81-
- preset: "vc6-relwithdebinfo"
86+
- configurePreset: "vc6"
87+
buildPreset: "vc6-relwithdebinfo"
8288
tools: true
8389
extras: true
84-
- preset: "vc6-dev-release"
90+
- configurePreset: "vc6-dev"
91+
buildPreset: "vc6-dev-release"
8592
tools: true
8693
extras: true
87-
- preset: "vc6-dev-relwithdebinfo"
94+
- configurePreset: "vc6-dev"
95+
buildPreset: "vc6-dev-relwithdebinfo"
8896
tools: true
8997
extras: true
9098
fail-fast: false
9199
uses: ./.github/workflows/build-toolchain.yml
92100
with:
93101
game: "Generals"
94-
preset: ${{ matrix.preset }}
102+
configurePreset: ${{ matrix.configurePreset }}
103+
buildPreset: ${{ matrix.buildPreset }}
95104
tools: ${{ matrix.tools }}
96105
extras: ${{ matrix.extras }}
97106
secrets: inherit
98107

99108
build-generalsmd:
100-
name: Build GeneralsMD${{ matrix.preset && '' }}
109+
name: Build GeneralsMD (${{ matrix.configurePreset }} | ${{ matrix.buildPreset }})
101110
needs: detect-changes
102111
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
103112
strategy:
104113
matrix:
105114
include:
106-
- preset: "release"
115+
- configurePreset: "default"
116+
buildPreset: "release"
107117
tools: true
108118
extras: true
109-
- preset: "relwithdebinfo"
119+
- configurePreset: "default"
120+
buildPreset: "relwithdebinfo"
110121
tools: true
111122
extras: true
112-
- preset: "dev-release"
123+
- configurePreset: "dev"
124+
buildPreset: "dev-release"
113125
tools: true
114126
extras: true
115-
- preset: "dev-relwithdebinfo"
127+
- configurePreset: "dev"
128+
buildPreset: "dev-relwithdebinfo"
116129
tools: true
117130
extras: true
118-
- preset: "vc6-release"
131+
- configurePreset: "vc6"
132+
buildPreset: "vc6-release"
119133
tools: true
120134
extras: true
121-
- preset: "vc6-relwithdebinfo"
135+
- configurePreset: "vc6"
136+
buildPreset: "vc6-relwithdebinfo"
122137
tools: true
123138
extras: true
124-
- preset: "vc6-dev-release"
139+
- configurePreset: "vc6-dev"
140+
buildPreset: "vc6-dev-release"
125141
tools: true
126142
extras: true
127-
- preset: "vc6-dev-relwithdebinfo"
143+
- configurePreset: "vc6-dev"
144+
buildPreset: "vc6-dev-relwithdebinfo"
128145
tools: true
129146
extras: true
130147
fail-fast: false
131148
uses: ./.github/workflows/build-toolchain.yml
132149
with:
133150
game: "GeneralsMD"
134-
preset: ${{ matrix.preset }}
151+
configurePreset: ${{ matrix.configurePreset }}
152+
buildPreset: ${{ matrix.buildPreset }}
135153
tools: ${{ matrix.tools }}
136154
extras: ${{ matrix.extras }}
137155
secrets: inherit

0 commit comments

Comments
 (0)