Skip to content

Commit b10438d

Browse files
unity-cli@v1.8.2
- add additional unity utp log handling
1 parent 89e7372 commit b10438d

8 files changed

Lines changed: 119 additions & 5 deletions

File tree

.github/workflows/build-options.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"6000.1.*",
1818
"6000.2"
1919
],
20+
"tests": [
21+
"CompilerWarnings",
22+
"CompilerErrors",
23+
"BuildWarnings",
24+
"BuildErrors",
25+
"PlaymodeTestsErrors",
26+
"EditmodeTestsErrors"
27+
],
2028
"include": [
2129
{
2230
"os": "ubuntu-latest",

.github/workflows/unity-build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ jobs:
132132
PACKAGE_MANAGER_LOG_PATH=$(unity-cli package-manager-logs)
133133
LICENSING_CLIENT_LOG_PATH=$(unity-cli licensing-client-logs)
134134
LICENSING_AUDIT_LOG_PATH=$(unity-cli licensing-audit-logs)
135-
135+
136136
echo "Hub Log Path: ${HUB_LOG_PATH}"
137137
echo "Package Manager Log Path: ${PACKAGE_MANAGER_LOG_PATH}"
138138
echo "Licensing Client Log Path: ${LICENSING_CLIENT_LOG_PATH}"
139139
echo "Licensing Audit Log Path: ${LICENSING_AUDIT_LOG_PATH}"
140-
140+
141141
if [ ! -f "${HUB_LOG_PATH}" ]; then
142142
echo "::warning:: Hub log file does not exist at ${HUB_LOG_PATH}"
143143
# find all info-log.json files in ~/.config/unity3d/ - print their paths
@@ -151,18 +151,25 @@ jobs:
151151
find ~/.config/ -type f -exec echo "{}" \;
152152
echo "::warning:: Hub log file does not exist at any known location"
153153
fi
154-
154+
155155
if [ ! -f "${PACKAGE_MANAGER_LOG_PATH}" ]; then
156156
echo "::warning::Package Manager log file does not exist at ${PACKAGE_MANAGER_LOG_PATH}"
157157
fi
158-
158+
159159
if [ ! -f "${LICENSING_CLIENT_LOG_PATH}" ]; then
160160
echo "::error::Licensing Client log file does not exist at ${LICENSING_CLIENT_LOG_PATH}"
161161
fi
162-
162+
163163
if [ ! -f "${LICENSING_AUDIT_LOG_PATH}" ]; then
164164
echo "::error::Licensing Audit log file does not exist at ${LICENSING_AUDIT_LOG_PATH}"
165165
fi
166+
- name: Upload UTP logs
167+
if: always()
168+
uses: actions/upload-artifact@v6
169+
with:
170+
name: utp-logs-${{ matrix.name }}
171+
path: '**/*-utp-json.log'
172+
if-no-files-found: ignore
166173
- name: Return License
167174
if: always()
168175
run: unity-cli return-license --license personal

unity-tests/BuildErrors.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using UnityEditor;
2+
using UnityEditor.Build;
3+
using UnityEditor.Build.Reporting;
4+
5+
namespace UnityCli.UtpSamples
6+
{
7+
/// <summary>
8+
/// Forces the build pipeline to fail by throwing a BuildFailedException.
9+
/// Place under an Editor folder when copying into a project.
10+
/// </summary>
11+
public class BuildErrors : IPreprocessBuildWithReport
12+
{
13+
public int callbackOrder => 0;
14+
15+
public void OnPreprocessBuild(BuildReport report)
16+
{
17+
throw new System.Exception("Intentional build failure for test matrix coverage.");
18+
}
19+
}
20+
}

unity-tests/BuildWarnings.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using UnityEditor;
2+
using UnityEditor.Build;
3+
using UnityEditor.Build.Reporting;
4+
5+
namespace UnityCli.UtpSamples
6+
{
7+
/// <summary>
8+
/// Emits a build-time warning via the build pipeline (no custom UTP JSON logging).
9+
/// Place under an Editor folder when copying into a project.
10+
/// </summary>
11+
public class BuildWarnings : IPreprocessBuildWithReport
12+
{
13+
public int callbackOrder => 0;
14+
15+
public void OnPreprocessBuild(BuildReport report)
16+
{
17+
UnityEngine.Debug.LogWarning("Intentional build warning for test matrix coverage.");
18+
}
19+
}
20+
}

unity-tests/CompilerErrors.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Intentional compiler error for matrix scenario coverage.
2+
#error Intentional compiler error: CS1029
3+
4+
// Note: file is kept minimal so it can be copied into a project to force a build failure.

unity-tests/CompilerWarnings.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using UnityEngine;
2+
3+
namespace UnityCli.UtpSamples
4+
{
5+
/// <summary>
6+
/// Introduces a benign compiler warning (unused variable) without emitting custom logs.
7+
/// </summary>
8+
public class CompilerWarnings : MonoBehaviour
9+
{
10+
private void Awake()
11+
{
12+
ObsoleteApi(); // CS0618: call to obsolete member
13+
}
14+
15+
[System.Obsolete("Intentional warning for test matrix coverage", false)]
16+
private static void ObsoleteApi()
17+
{
18+
}
19+
}
20+
}

unity-tests/EditmodeTestsErrors.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using NUnit.Framework;
2+
3+
namespace UnityCli.UtpSamples
4+
{
5+
/// <summary>
6+
/// Editmode test that intentionally fails to produce real test failure output.
7+
/// </summary>
8+
public class EditmodeTestsErrors
9+
{
10+
[Test]
11+
public void FailsEditmodeSuite()
12+
{
13+
Assert.Fail("Intentional editmode failure for test matrix coverage.");
14+
}
15+
}
16+
}

unity-tests/PlaymodeTestsErrors.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Collections;
2+
using NUnit.Framework;
3+
using UnityEngine.TestTools;
4+
5+
namespace UnityCli.UtpSamples
6+
{
7+
/// <summary>
8+
/// Playmode test that intentionally fails to generate real test failure output.
9+
/// </summary>
10+
public class PlaymodeTestsErrors
11+
{
12+
[UnityTest]
13+
public IEnumerator FailsPlaymodeSuite()
14+
{
15+
yield return null;
16+
Assert.Fail("Intentional playmode failure for test matrix coverage.");
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)