Skip to content

Commit 7f1c5e2

Browse files
committed
Consolidate stable Unity tests
1 parent 38cf051 commit 7f1c5e2

2 files changed

Lines changed: 47 additions & 105 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 91 deletions
This file was deleted.

.github/workflows/unity-test.yml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
unityVersion:
25+
- "2019.4.41f2"
26+
- "2022.3.62f2"
27+
- "6000.3.1f1"
2528
- "6000.5.5f1"
2629
container:
2730
image: unityci/editor:ubuntu-${{ matrix.unityVersion }}-base-3.2.2
@@ -125,22 +128,52 @@ jobs:
125128
-print -quit 2>/dev/null || true
126129
)"
127130
128-
if [[ -z "$test_framework_manifest" || -z "$ugui_manifest" ]]; then
129-
echo "::error::Cannot find Unity's built-in test-framework and ugui metadata."
130-
exit 1
131+
if [[ -n "$test_framework_manifest" && -n "$ugui_manifest" ]]; then
132+
jq -n \
133+
--arg testFrameworkVersion \
134+
"$(jq -er '.version' "$test_framework_manifest")" \
135+
--arg uguiVersion \
136+
"$(jq -er '.version' "$ugui_manifest")" \
137+
'{
138+
dependencies: {
139+
"com.unity.test-framework": $testFrameworkVersion,
140+
"com.unity.ugui": $uguiVersion
141+
}
142+
}' > /tmp/unity-default-packages.json
143+
else
144+
template_dir="$(dirname "$UNITY_EDITOR_PATH")/Data/Resources/PackageManager/ProjectTemplates"
145+
template_archive="$(
146+
find "$template_dir" -type f \
147+
-name 'com.unity.template.3d-*.tgz' -print -quit \
148+
2>/dev/null || true
149+
)"
150+
if [[ -z "$template_archive" ]]; then
151+
echo "::error::Cannot find Unity's built-in package metadata or 3D template."
152+
exit 1
153+
fi
154+
155+
manifest_entry="$(
156+
tar -tzf "$template_archive" \
157+
| grep '/Packages/manifest.json$' \
158+
| head -n 1
159+
)"
160+
if [[ -z "$manifest_entry" ]]; then
161+
echo "::error::Cannot find Packages/manifest.json in $template_archive."
162+
exit 1
163+
fi
164+
165+
tar -xOzf "$template_archive" "$manifest_entry" \
166+
> /tmp/unity-default-packages.json
131167
fi
132168
133-
jq -n \
134-
--arg testFrameworkVersion \
135-
"$(jq -er '.version' "$test_framework_manifest")" \
136-
--arg uguiVersion \
137-
"$(jq -er '.version' "$ugui_manifest")" \
138-
'{
139-
dependencies: {
140-
"com.unity.test-framework": $testFrameworkVersion,
141-
"com.unity.ugui": $uguiVersion
142-
}
143-
}' > /tmp/unity-default-packages.json
169+
if ! jq -e '
170+
.dependencies["com.unity.test-framework"] != null
171+
and .dependencies["com.unity.ugui"] != null
172+
' /tmp/unity-default-packages.json >/dev/null
173+
then
174+
echo "::error::Unity defaults do not define test-framework and ugui."
175+
exit 1
176+
fi
144177
cat /tmp/unity-default-packages.json
145178
146179
- name: Prepare test project

0 commit comments

Comments
 (0)