-
-
Notifications
You must be signed in to change notification settings - Fork 11
246 lines (211 loc) · 9.37 KB
/
Copy pathbuild-and-test.yml
File metadata and controls
246 lines (211 loc) · 9.37 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
name: build-and-test
on:
push:
branches-ignore:
- "dependabot/**"
- "gh-pages"
tags-ignore:
- "v*"
pull_request:
branches:
- "main"
- "develop"
permissions:
contents: read
checks: write
concurrency:
group: unity-build-and-test-${{ github.ref }}
cancel-in-progress: true
jobs:
unity-editmode:
name: Unity EditMode (${{ matrix.package_display_name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package_display_name: FixedMathSharp
package_name: com.mrdav30.fixedmathsharp
package_path: com.mrdav30.fixedmathsharp
runtime_assembly: FixedMathSharp.Runtime
artifact_suffix: standard
- package_display_name: FixedMathSharp Lean
package_name: com.mrdav30.fixedmathsharp.lean
package_path: com.mrdav30.fixedmathsharp.lean
runtime_assembly: FixedMathSharp.Lean.Runtime
artifact_suffix: lean
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Prepare Unity test project
shell: bash
run: |
set -euo pipefail
bash .assets/ci/scripts/prepare-unity-editmode-test-project.sh \
--project-path ".ci/unity-project" \
--package-name "${{ matrix.package_name }}" \
--package-path "${{ matrix.package_path }}" \
--runtime-assembly "${{ matrix.runtime_assembly }}"
- name: Cache Unity Library
uses: actions/cache@v5
with:
path: .ci/unity-project/Library
key: unity-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-${{ hashFiles('.assets/ci/scripts/prepare-unity-editmode-test-project.sh', '.assets/ci/unity-editmode-tests/**', 'Tests/EditMode/**/*.cs', 'Tests/Runtime/**/*.cs', 'com.mrdav30.fixedmathsharp/**/*.cs', 'com.mrdav30.fixedmathsharp/**/*.asmdef', 'com.mrdav30.fixedmathsharp/Plugins/**', 'com.mrdav30.fixedmathsharp/package.json', 'com.mrdav30.fixedmathsharp.lean/**/*.cs', 'com.mrdav30.fixedmathsharp.lean/**/*.asmdef', 'com.mrdav30.fixedmathsharp.lean/Plugins/**', 'com.mrdav30.fixedmathsharp.lean/package.json') }}
restore-keys: |
unity-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-
- name: Run Unity EditMode tests
id: tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: .ci/unity-project
unityVersion: 6000.5.0f1
customImage: unityci/editor:ubuntu-6000.5.0f1-base-3
testMode: EditMode
customParameters: -assemblyNames FixedMathSharp.Unity.Tests.EditMode -runSynchronously
artifactsPath: artifacts/${{ matrix.artifact_suffix }}
githubToken: ${{ github.token }}
checkName: Unity EditMode ${{ matrix.package_display_name }}
- name: Upload Unity test artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: unity-editmode-${{ matrix.artifact_suffix }}
path: artifacts/${{ matrix.artifact_suffix }}
- name: Setup .NET for API documentation
if: matrix.artifact_suffix == 'standard'
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Prepare API documentation references
if: matrix.artifact_suffix == 'standard'
shell: bash
run: |
set -euo pipefail
image="unityci/editor:ubuntu-6000.5.0f1-base-3"
container="$(docker create "$image")"
trap 'docker rm -f "$container" >/dev/null 2>&1 || true' EXIT
mkdir -p .docs/api/obj/references
docker cp \
"$container:/opt/unity/Editor/Data/Managed/UnityEngine/UnityEngine.CoreModule.dll" \
.docs/api/obj/references/UnityEngine.CoreModule.dll
cp com.mrdav30.fixedmathsharp/Plugins/FixedMathSharp.dll \
.docs/api/obj/references/FixedMathSharp.dll
- name: Build API documentation
if: matrix.artifact_suffix == 'standard'
shell: bash
run: |
set -euo pipefail
dotnet tool restore
dotnet tool run docfx .docs/api/docfx.json
test -f .docs/api/obj/_site/index.html
test -f .docs/api/obj/_site/api/FixedMathSharp.FixedCurveUnityExtensions.html
test -f .docs/api/obj/_site/api/FixedMathSharp.Geometry.FixedFrustumUnityExtensions.html
- name: Upload API documentation site
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.artifact_suffix == 'standard'
uses: actions/upload-pages-artifact@v5
with:
path: .docs/api/obj/_site
unity-sample-import-smoke:
name: Unity Sample Import Smoke (${{ matrix.package_display_name }})
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package_display_name: FixedMathSharp
package_name: com.mrdav30.fixedmathsharp
package_path: com.mrdav30.fixedmathsharp
expected_sample_asmdef: FixedMathSharp.Samples.asmdef
artifact_suffix: standard
- package_display_name: FixedMathSharp Lean
package_name: com.mrdav30.fixedmathsharp.lean
package_path: com.mrdav30.fixedmathsharp.lean
expected_sample_asmdef: FixedMathSharp.Lean.Samples.asmdef
artifact_suffix: lean
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Prepare Unity sample import smoke project
shell: bash
run: |
set -euo pipefail
bash .assets/ci/scripts/prepare-unity-sample-import-smoke.sh \
--project-path ".ci/unity-sample-import-${{ matrix.artifact_suffix }}" \
--package-name "${{ matrix.package_name }}" \
--package-path "${{ matrix.package_path }}" \
--expected-sample-asmdef "${{ matrix.expected_sample_asmdef }}" \
--workspace-path "/github/workspace" \
--git-sha "$GITHUB_SHA"
- name: Cache Unity sample import Library
uses: actions/cache@v5
with:
path: .ci/unity-sample-import-${{ matrix.artifact_suffix }}/Library
key: unity-sample-import-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-${{ hashFiles('.assets/ci/scripts/prepare-unity-sample-import-smoke.sh', '.assets/ci/unity-sample-import-smoke/**', 'com.mrdav30.fixedmathsharp/Plugins/**', 'com.mrdav30.fixedmathsharp/package.json', 'com.mrdav30.fixedmathsharp/Samples~/**', 'com.mrdav30.fixedmathsharp.lean/Plugins/**', 'com.mrdav30.fixedmathsharp.lean/package.json', 'com.mrdav30.fixedmathsharp.lean/Samples~/**') }}
restore-keys: |
unity-sample-import-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-
- name: Trust local Git checkout inside Unity container
shell: bash
run: |
set -euo pipefail
container_home="$RUNNER_TEMP/_github_home"
mkdir -p "$container_home"
git config --file "$container_home/.gitconfig" --add safe.directory /github/workspace
git config --file "$container_home/.gitconfig" --add safe.directory /github/workspace/.git
- name: Run Unity sample import smoke
id: sample-import
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: .ci/unity-sample-import-${{ matrix.artifact_suffix }}
unityVersion: 6000.5.0f1
customImage: unityci/editor:ubuntu-6000.5.0f1-base-3
testMode: EditMode
customParameters: -assemblyNames FixedMathSharp.SampleImportSmokeTests -runSynchronously
artifactsPath: artifacts/sample-import-${{ matrix.artifact_suffix }}
githubToken: ${{ github.token }}
checkName: Unity Sample Import ${{ matrix.package_display_name }}
- name: Scan Unity sample import log
if: always() && steps.sample-import.outcome != 'skipped'
shell: bash
run: |
set -euo pipefail
bash .assets/ci/scripts/scan-unity-sample-import-log.sh \
"artifacts/sample-import-${{ matrix.artifact_suffix }}/editmode.log"
- name: Upload Unity sample import artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: unity-sample-import-${{ matrix.artifact_suffix }}
path: artifacts/sample-import-${{ matrix.artifact_suffix }}
deploy-docs:
name: Deploy API documentation
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: unity-editmode
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure Pages
uses: actions/configure-pages@v6
- name: Deploy API documentation
id: deployment
uses: actions/deploy-pages@v5