-
-
Notifications
You must be signed in to change notification settings - Fork 495
306 lines (286 loc) · 13.8 KB
/
test.yml
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
name: Platform Tests
on:
push:
branches:
- master
paths-ignore:
- '.github/workflows/docs.yml'
- 'Harmony/Documentation/*'
pull_request:
branches:
- master
paths-ignore:
- '.github/workflows/docs.yml'
- 'Harmony/Documentation/*'
workflow_dispatch:
concurrency:
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
env:
# Right now we can't run experimental tests that can fail, since it will affect the PR
# We could potentially exclude experimental build on PR and only run it on master push
EXPERIMENTAL: false
# If set true, each target framework will be tested in it's own job instead of a single job
# NOTE: At some point when we'll have more target frameworks, parallelization should be more efficient
# It also will be more efficient once the `windows` workers will have a faster startup time
# METRICS:
# PARALLEL: true & PREBUILD: true ~ 15 minutes
# PARALLEL: false ~ 7 minutes
PARALLEL: false
# Whether we should build the binaries before running the tests
# Use with `PARALLEL: true` to reduce the execution time of test jobs, this increasing the throughput
PREBUILD: false
# You are interested in changing these values
BUILD_CONFIGURATIONS: "['ReleaseFat', 'ReleaseThin']"
BUILD_CONFIGURATIONS_WITH_REF: "['ReleaseFat', 'ReleaseThin', 'ReleaseRef']"
DOTNET_TARGET_FRAMEWORKS: "['netcoreapp3.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0']"
DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64: "['net6.0', 'net7.0', 'net8.0', 'net9.0']"
FRAMEWORK_TARGET_FRAMEWORKS: "['net35', 'net452', 'net472', 'net48']"
jobs:
# https://stackoverflow.com/a/77549656
variables:
name: Variable Accessibility Workaround for Jobs
runs-on: ubuntu-latest
outputs:
EXPERIMENTAL: ${{env.EXPERIMENTAL}}
PARALLEL: ${{env.PARALLEL}}
PREBUILD: ${{env.PREBUILD}}
BUILD_CONFIGURATIONS: ${{env.BUILD_CONFIGURATIONS}}
BUILD_CONFIGURATIONS_WITH_REF: ${{env.BUILD_CONFIGURATIONS_WITH_REF}}
DOTNET_TARGET_FRAMEWORKS: ${{env.DOTNET_TARGET_FRAMEWORKS}}
DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64: ${{env.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64}}
FRAMEWORK_TARGET_FRAMEWORKS: ${{env.FRAMEWORK_TARGET_FRAMEWORKS}}
steps:
- name: Compute outputs
run: |
echo "EXPERIMENTAL=${{env.EXPERIMENTAL}}" >> $GITHUB_OUTPUT
echo "PARALLEL=${{env.PARALLEL}}" >> $GITHUB_OUTPUT
echo "PREBUILD=${{env.PREBUILD}}" >> $GITHUB_OUTPUT
echo "BUILD_CONFIGURATIONS=${{env.BUILD_CONFIGURATIONS}}" >> $GITHUB_OUTPUT
echo "BUILD_CONFIGURATIONS_WITH_REF=${{env.BUILD_CONFIGURATIONS_WITH_REF}}" >> $GITHUB_OUTPUT
echo "DOTNET_TARGET_FRAMEWORKS=${{env.DOTNET_TARGET_FRAMEWORKS}}" >> $GITHUB_OUTPUT
echo "DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64=${{env.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64}}" >> $GITHUB_OUTPUT
echo "FRAMEWORK_TARGET_FRAMEWORKS=${{env.FRAMEWORK_TARGET_FRAMEWORKS}}" >> $GITHUB_OUTPUT
# Ideally we should be able to build binaries on Ubuntu to all platforms to test
# and have a job that will create binaries on each platform and compare the output dll's
build-binaries:
name: Build Binaries
needs: variables
strategy:
matrix:
image: [ { os: 'windows', code: 'windows-latest' }, { os: 'ubuntu', code: 'ubuntu-latest' }, { os: 'macos', code: 'macos-13' }, { os: 'macos-arm64', code: 'macos-14' } ]
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS_WITH_REF)}}
uses: ./.github/workflows/test-build.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
build_configuration: ${{matrix.build_configuration}}
publish: ${{matrix.image.os == 'ubuntu'}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
windows-dotnet:
name: Windows .NET x86/x64
needs: [variables, build-binaries]
strategy:
matrix:
architecture: ['x86', 'x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-windows-dotnet.yml
with:
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
windows-framework:
name: Windows .NET Framework x86/x64
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
architecture: ['x86', 'x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-windows-framework.yml
with:
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
windows-mono:
name: Windows Mono x86/x64
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
architecture: ['x86', 'x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-windows-mono.yml
with:
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
ubuntu-macos-x64-dotnet:
name: Ubuntu/MacOS .NET x64
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
image: [ { os: 'ubuntu', code: 'ubuntu-latest' }, { os: 'macos', code: 'macos-13' } ]
architecture: ['x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-dotnet.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework }}
target_framework_array: ${{needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
ubuntu-macos-x64-mono:
name: Ubuntu/MacOS Mono x64
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
image: [ { os: 'ubuntu', code: 'ubuntu-latest' }, { os: 'macos', code: 'macos-13' } ]
architecture: ['x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-mono.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
macos-rosetta-dotnet:
name: MacOS .NET Rosetta 2
needs: [variables, build-binaries]
if: ${{needs.variables.outputs.EXPERIMENTAL == 'true'}}
strategy:
fail-fast: false
matrix:
image: [ { os: 'macos-arm64', code: 'macos-14' } ]
architecture: ['x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-dotnet.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework }}
target_framework_array: ${{needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
macos-rosetta-mono:
name: MacOS Mono Rosetta 2
needs: [variables, build-binaries]
strategy:
fail-fast: false
matrix:
image: [ { os: 'macos-arm64', code: 'macos-14' } ]
architecture: ['x64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-mono.yml
with:
os: ${{matrix.image.os}}
image: ${{matrix.image.code}}
architecture: ${{matrix.architecture}}
target_framework: ${{matrix.target_framework}}
target_framework_array: ${{needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
ubuntu-arm64-dotnet:
name: Ubuntu .NET arm64
needs: [variables, build-binaries]
if: ${{needs.variables.outputs.EXPERIMENTAL == 'true'}}
strategy:
fail-fast: false
matrix:
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-qemu-dotnet.yml
with:
target_framework: ${{matrix.target_framework}}
#target_framework_array: ${{fromJson(needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64)}}
build_configuration: ${{ matrix.build_configuration }}
run_settings_args: 'NUnit.DefaultTestNamePattern="{C}:{m}{a}" RunConfiguration.TargetPlatform=arm64'
#manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
experimental: true
ubuntu-arm64-mono:
name: Ubuntu .NET arm64
needs: [variables, build-binaries]
if: ${{needs.variables.outputs.EXPERIMENTAL == 'true'}}
strategy:
fail-fast: false
matrix:
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-qemu-mono.yml
with:
target_framework: ${{matrix.target_framework}}
#target_framework_array: ${{fromJson(needs.variables.outputs.FRAMEWORK_TARGET_FRAMEWORKS)}}
build_configuration: ${{matrix.build_configuration}}
run_settings_args: 'NUnit.DefaultTestNamePattern="{C}:{m}{a}" RunConfiguration.TargetPlatform=arm64'
#manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
experimental: true
macos-arm64-dotnet:
name: MacOS .NET arm64
needs: [variables, build-binaries]
if: ${{needs.variables.outputs.EXPERIMENTAL == 'true'}}
strategy:
fail-fast: false
matrix:
image: [ { os: 'macos-arm64', code: 'macos-14' } ]
architecture: ['arm64']
target_framework: ${{fromJson((needs.variables.outputs.PARALLEL == 'true' && needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64) || '[""]')}}
build_configuration: ${{fromJson(needs.variables.outputs.BUILD_CONFIGURATIONS)}}
uses: ./.github/workflows/test-unix-dotnet.yml
with:
os: ${{ matrix.image.os }}
image: ${{ matrix.image.code }}
architecture: ${{ matrix.architecture }}
target_framework: ${{ matrix.target_framework }}
target_framework_array: ${{fromJson(needs.variables.outputs.DOTNET_TARGET_FRAMEWORKS_MACOS_ARM64)}}
build_configuration: ${{matrix.build_configuration}}
manual_build: ${{needs.variables.outputs.PREBUILD != 'true'}}
experimental: true
test-results:
name: Download and Upload Test Results
needs: [windows-dotnet, windows-framework, windows-mono, ubuntu-macos-x64-dotnet, ubuntu-macos-x64-mono, macos-rosetta-dotnet, macos-rosetta-mono]
if: always()
uses: ./.github/workflows/test-result-upload.yml
test-results-experimental:
name: Download and Upload Test Results (Experimental)
needs: [ubuntu-arm64-dotnet, ubuntu-arm64-mono, macos-arm64-dotnet]
if: ${{needs.variables.outputs.EXPERIMENTAL == 'true' && always()}}
uses: ./.github/workflows/test-result-upload.yml
with:
experimental: true
cleanup-build-output:
name: Cleanup Build Output
needs: [test-results, test-results-experimental]
runs-on: ubuntu-latest
if: always()
steps:
- uses: joutvhu/delete-artifact@v2
with:
pattern: build-output-*
- uses: joutvhu/delete-artifact@v2
with:
pattern: test-results-*
- uses: joutvhu/delete-artifact@v2
if: ${{needs.variables.outputs.PARALLEL == 'true'}}
with:
pattern: experimental-test-results-*