-
-
Notifications
You must be signed in to change notification settings - Fork 13
186 lines (171 loc) · 6.58 KB
/
unity-tests.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
name: Unity Tests
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
unity-tests:
name: Test (${{ matrix.testMode.name }}, ${{ matrix.scriptingRuntime.name }}, ${{ matrix.mode.name }}, ${{ matrix.progress.name }}, ${{ matrix.objectPooling.name }}, ${{ matrix.unityVersion }}, ${{ matrix.devMode.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testMode:
- {
name: Editor,
value: PlayMode,
buildTargetId: 1
}
- {
name: Standalone,
value: Standalone,
buildTargetId: 1
}
# Not testing WebGL as unity-test-runner does not support it.
#- {
# name: WebGL,
# value: WebGL,
# buildTargetId: 13
# }
scriptingRuntime:
- {
name: Net3.5,
version: 0,
apiCompatibilityLevel: 2,
}
- {
name: Net4.x,
version: 1,
apiCompatibilityLevel: 6
}
mode:
- {
name: Release,
symbol: PROTO_PROMISE_DEBUG_DISABLE
}
- {
name: Debug,
symbol: PROTO_PROMISE_DEBUG_ENABLE
}
progress:
- {
name: Progress_Enabled,
symbol: PROTO_PROMISE_PROGRESS_ENABLE
}
- {
name: Progress_Disabled,
symbol: PROTO_PROMISE_PROGRESS_DISABLE
}
objectPooling:
- {
name: Pool_Enabled,
symbol: PROTO_PROMISE_POOL_ENABLE
}
- {
name: Pool_Disabled,
symbol: PROTO_PROMISE_POOL_DISABLE
}
# Editor uses 2018.4 to test Net3.5 and Net4.x.
# Standalone uses 2019.4 and 2021.3 to test IL2CPP with netstandard 2.0 and netstandard2.1.
unityVersion: [2018.4.36f1, 2019.4.40f1, 2021.3.15f1]
devMode:
- {
name: devMode,
symbol: PROTO_PROMISE_DEVELOPER_MODE
}
- {
name: userMode,
symbol: PROTO_PROMISE_DEVELOPER_MODE_DISABLE
}
exclude:
# DEBUG mode forces pooling disabled.
- {
mode: { name: Debug },
objectPooling: { name: Pool_Enabled }
}
# Editor tests only run in 2018.4 to test Net3.5 and Net4.x.
- {
testMode: { name: Editor },
unityVersion: 2019.4.40f1
}
- {
testMode: { name: Editor },
unityVersion: 2021.3.15f1
}
# Standalone with IL2CPP can only be built with 2019.4+ (unity-builder docker images constraint), which doesn't support Net3.5.
- {
testMode: { name: Standalone },
unityVersion: 2018.4.36f1
}
- {
testMode: { name: Standalone },
scriptingRuntime: { name: Net3.5 }
}
# Only test devMode in Net3.5 in editor, and 2021.3 IL2CPP
- {
devMode: { name: devMode },
testMode: { name: Editor },
scriptingRuntime: { name: Net4.x }
}
- {
devMode: { name: devMode },
unityVersion: 2019.4.40f1
}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Rewrite ProjectSettings
run: |
DefineSymbols="${{ matrix.testMode.symbol }};${{ matrix.progress.symbol }};${{ matrix.objectPooling.symbol }};${{ matrix.devMode.symbol }}"
DefineOriginal=" scriptingDefineSymbols: {}"
DefineReplace=" scriptingDefineSymbols: \\n ${{ matrix.testMode.buildTargetId }}: $DefineSymbols"
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
RuntimeOriginal=" scriptingRuntimeVersion: 0"
RuntimeReplace=" scriptingRuntimeVersion: ${{ matrix.scriptingRuntime.version }}"
sed -i "{s/$RuntimeOriginal/$RuntimeReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
ApiOriginal=" apiCompatibilityLevel: 2"
ApiReplace=" apiCompatibilityLevel: ${{ matrix.scriptingRuntime.apiCompatibilityLevel }}"
sed -i "{s/$ApiOriginal/$ApiReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
- name: Run tests
id: tests
# The commit that added standalone support (new version has not yet been released).
uses: game-ci/unity-test-runner@31086d985910613d75c32ba965f657df9c298820
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_2018_4_36F1_UBUNTU }}
with:
projectPath: ProtoPromise_Unity
testMode: ${{ matrix.testMode.value }}
unityVersion: ${{ matrix.unityVersion }}
timeout-minutes: 90
# Workaround for NUnit XML (see https://github.com/dorny/test-reporter/issues/98#issuecomment-867106931)
- name: Install NUnit
if: always()
run: |
nuget install NUnit.Console -Version 3.12.0
- name: Fetch transform code
if: always()
run: |
wget https://raw.githubusercontent.com/nunit/nunit-transforms/master/nunit3-junit/nunit3-junit.xslt
shell: bash
- name: Transform NUnit3 to JUnit
if: always()
run: |
Get-ChildItem . -Filter artifacts/*.xml | Foreach-Object {
$xml = Resolve-Path $_.FullName
$output = Join-Path ($pwd) ($_.BaseName + '_junit.xml')
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load("nunit3-junit.xslt");
$xslt.Transform($xml, $output);
}
shell: pwsh
- uses: dorny/test-reporter@v1
if: always()
with:
name: unity-test-results-${{ matrix.testMode.name }}-${{ matrix.scriptingRuntime.name }}-${{ matrix.mode.name }}-${{ matrix.progress.name }}-${{ matrix.objectPooling.name }}-${{ matrix.unityVersion }}-${{ matrix.devMode.name }}
path: "*_junit.xml"
reporter: java-junit
- uses: actions/upload-artifact@v2
if: always()
with:
name: unity-test-results-${{ matrix.testMode.name }}-${{ matrix.scriptingRuntime.name }}-${{ matrix.mode.name }}-${{ matrix.progress.name }}-${{ matrix.objectPooling.name }}-${{ matrix.unityVersion }}-${{ matrix.devMode.name }}
path: artifacts