From 3ed9766fd21bb41156e46c7ad1acf2fd96c5c629 Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sat, 26 Oct 2024 23:42:49 +0900 Subject: [PATCH 1/2] Add run tests on standalone player --- .github/workflows/test-integration.yml | 10 ++++++++-- .github/workflows/test.yml | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 0209cde..09b0462 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -40,6 +40,11 @@ jobs: - 2022.3.42f1 - 2023.2.20f1 - 6000.0.22f1 + testMode: + - All # run tests in editor + include: + - unityVersion: 2023.2.20f1 + testMode: Standalone # run tests on player steps: - name: Checkout repository @@ -72,10 +77,11 @@ jobs: with: githubToken: ${{ secrets.GITHUB_TOKEN }} unityVersion: ${{ matrix.unityVersion }} # Default is `auto` - checkName: test result (${{ matrix.unityVersion }}) + checkName: test result (${{ matrix.unityVersion }}, ${{ matrix.testMode }}) customParameters: -testCategory "Integration" coverageOptions: generateAdditionalMetrics;generateTestReferences;generateHtmlReport;generateAdditionalReports;dontClear;assemblyFilters:${{ env.assembly_filters }} # see: https://docs.unity3d.com/Packages/com.unity.testtools.codecoverage@1.2/manual/CoverageBatchmode.html + testMode: ${{ matrix.testMode }} env: UNITY_LICENSE: ${{ secrets[env.secret_key] }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -85,7 +91,7 @@ jobs: - name: Upload test results uses: actions/upload-artifact@v4 with: - name: TestResults-Unity${{ matrix.unityVersion }} + name: TestResults-Unity${{ matrix.unityVersion }}-${{ matrix.testMode }} path: | ${{ steps.test.outputs.artifactsPath }} ${{ steps.test.outputs.coveragePath }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de09cee..e315280 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,9 +41,13 @@ jobs: - 2022.3.42f1 - 2023.2.20f1 - 6000.0.22f1 + testMode: + - All # run tests in editor include: - unityVersion: 2019.4.40f1 octocov: true + - unityVersion: 2023.2.20f1 + testMode: Standalone # run tests on player steps: - name: Checkout repository @@ -76,10 +80,11 @@ jobs: with: githubToken: ${{ secrets.GITHUB_TOKEN }} unityVersion: ${{ matrix.unityVersion }} # Default is `auto` - checkName: test result (${{ matrix.unityVersion }}) + checkName: test result (${{ matrix.unityVersion }}, ${{ matrix.testMode }}) customParameters: -testCategory "!IgnoreCI;!Integration" coverageOptions: generateAdditionalMetrics;generateTestReferences;generateHtmlReport;generateAdditionalReports;dontClear;assemblyFilters:${{ env.assembly_filters }} # see: https://docs.unity3d.com/Packages/com.unity.testtools.codecoverage@1.2/manual/CoverageBatchmode.html + testMode: ${{ matrix.testMode }} env: UNITY_LICENSE: ${{ secrets[env.secret_key] }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} @@ -97,7 +102,7 @@ jobs: - name: Upload test results uses: actions/upload-artifact@v4 with: - name: TestResults-Unity${{ matrix.unityVersion }} + name: TestResults-Unity${{ matrix.unityVersion }}-${{ matrix.testMode }} path: | ${{ steps.test.outputs.artifactsPath }} ${{ steps.test.outputs.coveragePath }} From 112366b40b9a9e37f2ee90328939de5703e04ef6 Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Sun, 27 Oct 2024 00:26:03 +0900 Subject: [PATCH 2/2] Ignore test that would fail on player --- .../APIExamples/Tests/Runtime/NUnit/CustomConstraintExample.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/APIExamples/Tests/Runtime/NUnit/CustomConstraintExample.cs b/Assets/APIExamples/Tests/Runtime/NUnit/CustomConstraintExample.cs index ac17bde..70770b9 100644 --- a/Assets/APIExamples/Tests/Runtime/NUnit/CustomConstraintExample.cs +++ b/Assets/APIExamples/Tests/Runtime/NUnit/CustomConstraintExample.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using NUnit.Framework.Constraints; using UnityEngine; +using UnityEngine.TestTools; // ReSharper disable AccessToStaticMemberViaDerivedType @@ -34,6 +35,7 @@ public void CustomConstraint_Constraintの実装だけで可能な書きかた() } [Test] + [UnityPlatform(RuntimePlatform.OSXEditor, RuntimePlatform.WindowsEditor, RuntimePlatform.LinuxEditor)] public void CustomConstraint_Extensionsの実装も行なうと可能な書きかた() { var actual = CreateDestroyedObject();