forked from stride3d/stride
-
Notifications
You must be signed in to change notification settings - Fork 0
308 lines (284 loc) · 12.3 KB
/
Copy pathmain.yml
File metadata and controls
308 lines (284 loc) · 12.3 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
name: CI
on:
push:
branches:
- master
paths:
- '.github/workflows/**'
- 'build/**'
- 'deps/**'
- 'sources/**'
- 'tests/**'
- '!**/.all-contributorsrc'
- '!**/.editorconfig'
- '!**/.gitignore'
- '!**/*.md'
- '!crowdin.yml'
# No paths filter here: the Gate job is a required check, so CI must report on every PR.
# The changes job's filters skip the actual work for out-of-scope PRs.
pull_request:
# labeled/unlabeled so a `ci-run-on-draft` label takes effect immediately on a draft —
# without them main.yml wouldn't re-evaluate its draft gate until the next push.
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
workflow_dispatch:
inputs:
ios:
description: Run iOS jobs
type: boolean
default: true
android:
description: Run Android jobs
type: boolean
default: true
macos:
description: Run macOS jobs
type: boolean
default: true
permissions:
checks: write
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Per-area path-filter outputs drive the per-job `if:` conditions below.
# Defaults to 'true' for non-pull_request triggers (workflow_dispatch, push to master)
# so those run everything regardless of which files changed.
#
# Fork-friendly: upstream stride3d/stride always runs (the repository-name clause covers
# both direct pushes and fork→upstream PRs, where base-repo `vars` aren't readable from a
# fork PR's context). On forks, push/PR only run when STRIDE_ENABLE_PUSH_CI is set on the
# fork. workflow_dispatch always punches through so manual runs work anywhere. Downstream
# jobs `needs: changes`, so this single guard cascades — no per-job edits needed.
changes:
if: >
(github.event_name != 'push' && github.event_name != 'pull_request')
|| github.repository == 'stride3d/stride'
|| vars.STRIDE_ENABLE_PUSH_CI == 'true'
uses: ./.github/workflows/changes.yml
# Draft PRs skip all automatic CI to save runner minutes. Add a `ci-run-on-draft` label to
# run the normal path-gated suites while iterating, or a `ci-<suite>` label (see
# pr-label-suites.yml) for a specific opt-in suite. ready_for_review re-runs everything.
### Misc ###
Assembly-Processor:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && (needs.changes.outputs.runtime == 'true' || needs.changes.outputs.full == 'true')
uses: ./.github/workflows/build-assembly-processor.yml
with:
build-type: Release
VS-Package:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.full == 'true'
uses: ./.github/workflows/build-vspackage.yml
with:
build-type: Debug # Release has a bug and cannot build
### Runtimes ###
iOS-Runtime:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.ios == 'true' && (github.event_name != 'workflow_dispatch' || inputs.ios)
uses: ./.github/workflows/build-ios.yml
with:
build-type: Release
Android-Runtime:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.runtime == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android)
uses: ./.github/workflows/build-android.yml
with:
build-type: Release
Linux-Runtime:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.runtime == 'true'
uses: ./.github/workflows/build-linux-runtime.yml
with:
build-type: Release
Windows-Runtime-D3D11:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.runtime == 'true'
uses: ./.github/workflows/build-windows-runtime.yml
with:
build-type: Release
graphics-api: Direct3D11
Windows-Runtime-D3D12:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.runtime == 'true'
uses: ./.github/workflows/build-windows-runtime.yml
with:
build-type: Release
graphics-api: Direct3D12
Windows-Runtime-Vulkan:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.runtime == 'true'
uses: ./.github/workflows/build-windows-runtime.yml
with:
build-type: Release
graphics-api: Vulkan
### Full Windows build (engine + editor + assets + samples) ###
Windows-Full:
needs: changes
if: (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft')) && needs.changes.outputs.full == 'true'
uses: ./.github/workflows/build-windows-full.yml
with:
build-type: Debug
### Tests ###
# Game tests where the picked graphics API doesn't materially affect outcomes
# (physics, audio, asset, engine logic). One run with D3D11 is sufficient.
Windows-Tests-Game-ApiNeutral:
needs: [changes, Windows-Runtime-D3D11]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Windows-Runtime-D3D11'].result != 'failure'
&& needs['Windows-Runtime-D3D11'].result != 'cancelled'
uses: ./.github/workflows/test-windows-game-api-neutral.yml
with:
build-type: Debug
# Tests-Simple smoke-tests non-graphics paths; pinned to D3D11 build as the gate.
Windows-Tests-Simple:
needs: [changes, Windows-Runtime-D3D11]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Windows-Runtime-D3D11'].result != 'failure'
&& needs['Windows-Runtime-D3D11'].result != 'cancelled'
uses: ./.github/workflows/test-windows-simple.yml
with:
build-type: Debug
Windows-Tests-Game-D3D11:
needs: [changes, Windows-Runtime-D3D11]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Windows-Runtime-D3D11'].result != 'failure'
&& needs['Windows-Runtime-D3D11'].result != 'cancelled'
uses: ./.github/workflows/test-windows-game.yml
with:
build-type: Debug
graphics-api: Direct3D11
Windows-Tests-Game-D3D12:
needs: [changes, Windows-Runtime-D3D12]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Windows-Runtime-D3D12'].result != 'failure'
&& needs['Windows-Runtime-D3D12'].result != 'cancelled'
uses: ./.github/workflows/test-windows-game.yml
with:
build-type: Debug
graphics-api: Direct3D12
Windows-Tests-Game-Vulkan:
needs: [changes, Windows-Runtime-Vulkan]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Windows-Runtime-Vulkan'].result != 'failure'
&& needs['Windows-Runtime-Vulkan'].result != 'cancelled'
uses: ./.github/workflows/test-windows-game.yml
with:
build-type: Debug
graphics-api: Vulkan
Linux-Tests-Simple:
needs: [changes, Linux-Runtime]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Linux-Runtime'].result != 'failure'
&& needs['Linux-Runtime'].result != 'cancelled'
uses: ./.github/workflows/test-linux-simple.yml
with:
build-type: Debug
Linux-Tests-Game:
needs: [changes, Linux-Runtime]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Linux-Runtime'].result != 'failure'
&& needs['Linux-Runtime'].result != 'cancelled'
uses: ./.github/workflows/test-linux-game.yml
with:
build-type: Debug
# macOS runners bill ~10× Linux on GitHub-hosted; gate on Linux-Runtime so a broken build
# doesn't burn macOS minutes. MoltenVK/Vulkan path is unique to macOS so per-commit coverage
# catches regressions per-PR rather than via a stale cron snapshot.
macOS-Tests-Game:
needs: [changes, Linux-Runtime]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.runtime == 'true'
&& needs['Linux-Runtime'].result != 'failure'
&& needs['Linux-Runtime'].result != 'cancelled'
&& (github.event_name != 'workflow_dispatch' || inputs.macos)
uses: ./.github/workflows/test-macos-game.yml
with:
build-type: Debug
# iOS Simulator tests run on macOS runners and take ~24 min, so PRs only trigger them on
# strictly iOS-specific paths (ios-tests filter); master pushes still run them per-commit.
iOS-Tests-Game:
needs: [changes, Linux-Runtime]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.ios-tests == 'true'
&& needs['Linux-Runtime'].result != 'failure'
&& needs['Linux-Runtime'].result != 'cancelled'
&& (github.event_name != 'workflow_dispatch' || inputs.ios)
uses: ./.github/workflows/test-ios-game.yml
with:
build-type: Debug
# Android tests run on Linux + KVM-accelerated x86_64 emulator. Build APKs on the host,
# boot the emulator inside reactivecircus/android-emulator-runner, run each suite serially.
Android-Tests-Game:
needs: [changes, Linux-Runtime]
if: |
!cancelled()
&& (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'ci-run-on-draft'))
&& needs.changes.outputs.android == 'true'
&& needs['Linux-Runtime'].result != 'failure'
&& needs['Linux-Runtime'].result != 'cancelled'
&& (github.event_name != 'workflow_dispatch' || inputs.android)
uses: ./.github/workflows/test-android-game.yml
with:
build-type: Debug
# Aggregate result for branch protection: mark only "Gate" as required.
# Skipped jobs (path filters, draft PRs) are fine; failure/cancellation is not.
# always() on purpose (unlike the !cancelled() test jobs): a cancelled run must
# report a red Gate, not a skipped (= passing) one.
Gate:
needs:
- changes
- Assembly-Processor
- VS-Package
- iOS-Runtime
- Android-Runtime
- Linux-Runtime
- Windows-Runtime-D3D11
- Windows-Runtime-D3D12
- Windows-Runtime-Vulkan
- Windows-Full
- Windows-Tests-Game-ApiNeutral
- Windows-Tests-Simple
- Windows-Tests-Game-D3D11
- Windows-Tests-Game-D3D12
- Windows-Tests-Game-Vulkan
- Linux-Tests-Simple
- Linux-Tests-Game
- macOS-Tests-Game
- iOS-Tests-Game
- Android-Tests-Game
if: always()
runs-on: ubuntu-latest
steps:
- name: Fail if any needed job failed or was cancelled
env:
NEEDS: ${{ toJSON(needs) }}
run: |
echo "$NEEDS" | jq -r 'to_entries[] | "\(.value.result)\t\(.key)"'
test "$(echo "$NEEDS" | jq '[.[] | select(.result=="failure" or .result=="cancelled")] | length')" -eq 0