|
22 | 22 | fail-fast: false |
23 | 23 | matrix: |
24 | 24 | unityVersion: |
| 25 | + - "2019.4.41f2" |
| 26 | + - "2022.3.62f2" |
| 27 | + - "6000.3.1f1" |
25 | 28 | - "6000.5.5f1" |
26 | 29 | container: |
27 | 30 | image: unityci/editor:ubuntu-${{ matrix.unityVersion }}-base-3.2.2 |
@@ -125,22 +128,52 @@ jobs: |
125 | 128 | -print -quit 2>/dev/null || true |
126 | 129 | )" |
127 | 130 |
|
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 |
131 | 167 | fi |
132 | 168 |
|
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 |
144 | 177 | cat /tmp/unity-default-packages.json |
145 | 178 |
|
146 | 179 | - name: Prepare test project |
|
0 commit comments