Repository navigation
292 lines (277 loc) · 9.9 KB
/
Copy pathci.yml
File metadata and controls
292 lines (277 loc) · 9.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: GenCI
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
detect-changes:
name: Detect File Changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
generals: ${{ steps.filter.outputs.generals }}
generalsmd: ${{ steps.filter.outputs.generalsmd }}
shared: ${{ steps.filter.outputs.shared }}
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Filter Changed Paths
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
token: ''
filters: |
generals:
- 'Generals/**'
generalsmd:
- 'GeneralsMD/**'
shared:
- '.github/workflows/**'
- 'Benchmarks/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'cmake/**'
- 'Core/**'
- 'Dependencies/**'
- 'GeneralsReplays/**'
- 'Tests/**'
- 'vcpkg.json'
- name: Changes Summary
run: |
echo "### 🔍 File Changes Summary" >> $GITHUB_STEP_SUMMARY
echo "- Generals: ${{ steps.filter.outputs.generals == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
echo "- GeneralsMD: ${{ steps.filter.outputs.generalsmd == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
echo "- Shared: ${{ steps.filter.outputs.shared == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY
# Note the build jobs are split into two jobs for vc6 and win32 because the replay checks
# only require the vc6 build and compiling vc6 is much faster than win32
build-generals-vc6:
name: Build Generals${{ matrix.preset && '' }}
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
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-releaselog"
tools: true
extras: true
fail-fast: false
uses: ./.github/workflows/reusable-build-toolchain.yml
with:
game: "Generals"
preset: ${{ matrix.preset }}
tools: ${{ matrix.tools }}
extras: ${{ matrix.extras }}
secrets: inherit
build-generals-win32:
name: Build Generals${{ matrix.preset && '' }}
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- preset: "win32"
tools: true
extras: true
- preset: "win32-profile"
tools: true
extras: true
- preset: "win32-debug"
tools: true
extras: true
- preset: "win32-vcpkg"
tools: true
extras: true
- preset: "win32-vcpkg-profile"
tools: true
extras: true
- preset: "win32-vcpkg-debug"
tools: true
extras: true
fail-fast: false
uses: ./.github/workflows/reusable-build-toolchain.yml
with:
game: "Generals"
preset: ${{ matrix.preset }}
tools: ${{ matrix.tools }}
extras: ${{ matrix.extras }}
tests: true
benchmarks: ${{ matrix.preset == 'win32' }}
secrets: inherit
build-generalsmd-vc6:
name: Build GeneralsMD${{ matrix.preset && '' }}
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
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-releaselog"
tools: true
extras: true
fail-fast: false
uses: ./.github/workflows/reusable-build-toolchain.yml
with:
game: "GeneralsMD"
preset: ${{ matrix.preset }}
tools: ${{ matrix.tools }}
extras: ${{ matrix.extras }}
secrets: inherit
build-generalsmd-win32:
name: Build GeneralsMD${{ matrix.preset && '' }}
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- preset: "win32"
tools: true
extras: true
- preset: "win32-profile"
tools: true
extras: true
- preset: "win32-debug"
tools: true
extras: true
- preset: "win32-vcpkg"
tools: true
extras: true
ffmpeg: true
- preset: "win32-vcpkg-profile"
tools: true
extras: true
- preset: "win32-vcpkg-debug"
tools: true
extras: true
fail-fast: false
uses: ./.github/workflows/reusable-build-toolchain.yml
with:
game: "GeneralsMD"
preset: ${{ matrix.preset }}
tools: ${{ matrix.tools }}
extras: ${{ matrix.extras }}
ffmpeg: ${{ matrix.ffmpeg || false}}
tests: true
benchmarks: ${{ matrix.preset == 'win32' }}
secrets: inherit
# Runs separately so the build jobs, which also run for pull requests, do not need actions: write.
cleanup-ccache:
name: Delete Superseded Compiler Caches
needs: [build-generals-vc6, build-generals-win32, build-generalsmd-vc6, build-generalsmd-win32]
if: ${{ !cancelled() && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
actions: write
steps:
- name: Keep Only the Newest Cache per Configuration
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
$caches = @(gh cache list --ref $env:GITHUB_REF --key ccache- --limit 1000 --json id,key | ConvertFrom-Json)
if ($LASTEXITCODE -ne 0) { throw "Failed to list caches" }
$suffix = "-$env:GITHUB_SHA"
$current = @($caches | Where-Object key -like "*$suffix" | ForEach-Object key)
foreach ($cache in $caches) {
$newest = $cache.key.Substring(0, $cache.key.LastIndexOf('-')) + $suffix
# Configurations that did not save a cache in this run keep their older one.
if ($cache.key -ne $newest -and $current -contains $newest) {
gh cache delete $cache.id
if ($LASTEXITCODE -ne 0) { throw "Failed to delete cache $($cache.key)" }
Write-Host "Deleted $($cache.key)"
}
}
replaycheck-generals:
name: Replay Check Generals${{ matrix.preset && '' }}
needs: [detect-changes, build-generals-vc6]
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
strategy:
matrix:
include:
- preset: "vc6+t+e"
- preset: "vc6-releaselog+t+e" # optimized build with logging and crashing enabled should be compatible, so we test that here.
fail-fast: false
uses: ./.github/workflows/reusable-check-replays.yml
with:
game: "Generals"
userdata: "GeneralsReplays/Generals/1.08"
preset: ${{ matrix.preset }}
secrets: inherit
replaycheck-generalsmd:
name: Replay Check GeneralsMD${{ matrix.preset && '' }}
needs: [detect-changes, build-generalsmd-vc6]
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
strategy:
matrix:
include:
- preset: "vc6+t+e"
- preset: "vc6-releaselog+t+e" # optimized build with logging and crashing enabled should be compatible, so we test that here.
fail-fast: false
uses: ./.github/workflows/reusable-check-replays.yml
with:
game: "GeneralsMD"
userdata: "GeneralsReplays/GeneralsZH/1.04"
preset: ${{ matrix.preset }}
secrets: inherit
# Release preset only. mingw-w64-i686-profile is excluded because profiling uses MSVC inline assembly, which GCC does not compile.
build-mingw-generals:
name: Build Generals MinGW-w64
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
uses: ./.github/workflows/reusable-build-mingw.yml
with:
game: "Generals"
preset: "mingw-w64-i686"
build-mingw-generalsmd:
name: Build GeneralsMD MinGW-w64
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
permissions:
contents: read
uses: ./.github/workflows/reusable-build-mingw.yml
with:
game: "GeneralsMD"
preset: "mingw-w64-i686"