diff --git a/.yamato/code-coverage.yml b/.yamato/code-coverage.yml index 0e2d499f8d..88a7010fb2 100644 --- a/.yamato/code-coverage.yml +++ b/.yamato/code-coverage.yml @@ -14,13 +14,21 @@ code_coverage_{{ platform.name }}_{{ editor }}: image: {{ platform.image }} flavor: {{ platform.flavor }} commands: - - npm install -g upm-ci-utils@stable --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm - unity-downloader-cli -u {{ editor }} -c Editor --fast --wait - - {% if platform.name == "ubuntu" %}DISPLAY=:0 {% endif %} upm-ci package test -u {{ editor }} --package-path com.unity.netcode.gameobjects --enable-code-coverage --code-coverage-options 'generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.Netcode.Editor,+Unity.Netcode.Runtime' --extra-utr-arg="--extra-editor-arg=--burst-disable-compilation --extra-editor-arg=-testCategory --extra-editor-arg=!Performance --timeout=1800 --reruncount=1 --clean-library-on-rerun" + # Platform specific UTR setup + - | +{% if platform.name == "win" %} + curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat +{% else %} + curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr && chmod +x utr +{% endif %} + + - upm-pvp create-test-project test-project --packages "upm-ci~/packages/*.tgz" --filter "com.unity.netcode.gameobjects" --unity .Editor + - {% if platform.name == "ubuntu" %}DISPLAY=:0 {% endif %} {% if platform.name == "win" %} utr.bat {% else %} ./utr {% endif %} --suite=editor --suite=playmode --editor-location=.Editor --testproject=test-project --enable-code-coverage --coverage-options 'generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.Netcode.Editor,+Unity.Netcode.Runtime' --artifacts-path=test-results --coverage-results-path=test-results/CoverageResults --extra-editor-arg=--burst-disable-compilation --extra-editor-arg=-testCategory --extra-editor-arg=!Performance --timeout=1800 --reruncount=1 --clean-library-on-rerun artifacts: logs: paths: - - "upm-ci~/test-results/**/*" + - "test-results/**/*" dependencies: - .yamato/package-pack.yml#package_pack_-_ngo_{{ platform.name }} {% endfor -%} diff --git a/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs b/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs index 8e885ead97..63e4051004 100644 --- a/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs @@ -1,7 +1,4 @@ using Unity.Netcode.Components; -#if UNITY_UNET_PRESENT -using Unity.Netcode.Transports.UNET; -#endif using Unity.Netcode.Transports.UTP; using UnityEditor; using UnityEngine; @@ -28,6 +25,8 @@ public override void OnInspectorGUI() } } #if UNITY_UNET_PRESENT + using Unity.Netcode.Transports.UNET; + /// /// Internal use. Hides the script field for UNetTransport. /// diff --git a/com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs b/com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs index abbf1ddeb0..7b2126b39d 100644 --- a/com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs +++ b/com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs @@ -1793,7 +1793,7 @@ private bool CheckForStateChange(ref NetworkTransformState networkState, ref Tra #else var position = InLocalSpace ? transformToUse.localPosition : transformToUse.position; var rotation = InLocalSpace ? transformToUse.localRotation : transformToUse.rotation; - var positionThreshold = Vector3.one * PositionThreshold; + var positionThreshold = Vector3.one * PositionThreshold; var rotationThreshold = Vector3.one * RotAngleThreshold; #endif var rotAngles = rotation.eulerAngles; diff --git a/com.unity.netcode.gameobjects/TestHelpers/Runtime/Metrics/WaitForMetricValues.cs b/com.unity.netcode.gameobjects/TestHelpers/Runtime/Metrics/WaitForMetricValues.cs index 01013851a4..10e8c6b8c5 100644 --- a/com.unity.netcode.gameobjects/TestHelpers/Runtime/Metrics/WaitForMetricValues.cs +++ b/com.unity.netcode.gameobjects/TestHelpers/Runtime/Metrics/WaitForMetricValues.cs @@ -21,7 +21,7 @@ public WaitForMetricValues(IMetricDispatcher dispatcher, DirectionalMetricInfo d dispatcher.RegisterObserver(this); } - abstract public void Observe(MetricCollection collection); + public abstract void Observe(MetricCollection collection); public void AssertMetricValuesHaveNotBeenFound() { diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/MetricsDispatchTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/MetricsDispatchTests.cs index e8a268cf91..872a5b2c6a 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/MetricsDispatchTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/MetricsDispatchTests.cs @@ -1,9 +1,14 @@ #if MULTIPLAYER_TOOLS -using System; +// System namespaces using System.Collections; +using System; + +// Test framework using NUnit.Framework; -using Unity.Multiplayer.Tools.NetStats; using UnityEngine.TestTools; + +// Unity namespaces +using Unity.Multiplayer.Tools.NetStats; using Unity.Netcode.TestHelpers.Runtime; namespace Unity.Netcode.RuntimeTests.Metrics diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkObjectMetricsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkObjectMetricsTests.cs index dce18644f3..9715bcf96f 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkObjectMetricsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkObjectMetricsTests.cs @@ -1,12 +1,18 @@ #if MULTIPLAYER_TOOLS +// System namespaces using System.Collections; using System.Collections.Generic; using System.Linq; + +// Test framework using NUnit.Framework; -using Unity.Multiplayer.Tools.MetricTypes; -using UnityEngine; using UnityEngine.TestTools; +// Unity core +using UnityEngine; + +// Unity multiplayer specific +using Unity.Multiplayer.Tools.MetricTypes; using Unity.Netcode.TestHelpers.Runtime.Metrics; namespace Unity.Netcode.RuntimeTests.Metrics diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkVariableMetricsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkVariableMetricsTests.cs index 640cee4615..87d5c10bcf 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkVariableMetricsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/NetworkVariableMetricsTests.cs @@ -1,9 +1,14 @@ #if MULTIPLAYER_TOOLS +// System namespaces using System.Collections; using System.Linq; + +// Test framework using NUnit.Framework; -using Unity.Multiplayer.Tools.MetricTypes; using UnityEngine.TestTools; + +// Unity namespaces +using Unity.Multiplayer.Tools.MetricTypes; using Unity.Netcode.TestHelpers.Runtime.Metrics; namespace Unity.Netcode.RuntimeTests.Metrics diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/OwnershipChangeMetricsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/OwnershipChangeMetricsTests.cs index a3fcf30b3f..95fd4b6279 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/OwnershipChangeMetricsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/OwnershipChangeMetricsTests.cs @@ -1,11 +1,18 @@ #if MULTIPLAYER_TOOLS +// System namespaces using System.Collections; using System.Linq; + +// Test framework using NUnit.Framework; +using UnityEngine.TestTools; + +// Unity core using Unity.Collections; -using Unity.Multiplayer.Tools.MetricTypes; using UnityEngine; -using UnityEngine.TestTools; + +// Unity netcode and multiplayer specific +using Unity.Multiplayer.Tools.MetricTypes; using Unity.Netcode.TestHelpers.Runtime; using Unity.Netcode.TestHelpers.Runtime.Metrics; diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/PacketMetricsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/PacketMetricsTests.cs index 90707de0b8..3a1814e7ea 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/PacketMetricsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/PacketMetricsTests.cs @@ -1,10 +1,17 @@ #if MULTIPLAYER_TOOLS #if MULTIPLAYER_TOOLS_1_0_0_PRE_7 +// System namespaces using System.Collections; + +// Test framework using NUnit.Framework; +using UnityEngine.TestTools; + +// Unity core using Unity.Collections; + +// Unity multiplayer specific using Unity.Multiplayer.Tools.MetricTypes; -using UnityEngine.TestTools; using Unity.Netcode.TestHelpers.Runtime.Metrics; namespace Unity.Netcode.RuntimeTests.Metrics diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RpcMetricsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RpcMetricsTests.cs index b2b186a6f6..79bd2c02f1 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RpcMetricsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RpcMetricsTests.cs @@ -1,12 +1,22 @@ -#if MULTIPLAYER_TOOLS using System.Collections; using System.Linq; +// System namespaces first +using System.Collections; +using System.Linq; + +// Test framework namespaces second using NUnit.Framework; -using Unity.Collections; -using Unity.Multiplayer.Tools.MetricTypes; using UnityEngine.TestTools; + +// Unity core namespaces third +using Unity.Collections; + +// Unity specific packages last using Unity.Netcode.TestHelpers.Runtime.Metrics; +#if MULTIPLAYER_TOOLS +using Unity.Multiplayer.Tools.MetricTypes; + namespace Unity.Netcode.RuntimeTests.Metrics { internal class RpcMetricsTests : DualClientMetricTestBase diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RttMetricsTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RttMetricsTests.cs index 2c77c66f3a..fc714f71b0 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RttMetricsTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RttMetricsTests.cs @@ -1,13 +1,20 @@ #if MULTIPLAYER_TOOLS #if MULTIPLAYER_TOOLS_1_0_0_PRE_7 +// System namespaces using System.Collections; using System.Collections.Generic; using System.Linq; + +// Test framework using NUnit.Framework; +using UnityEngine.TestTools; + +// Unity core using Unity.Collections; + +// Unity netcode and multiplayer specific using Unity.Multiplayer.Tools.MetricTypes; -using UnityEngine.TestTools; using Unity.Netcode.TestHelpers.Runtime; using Unity.Netcode.TestHelpers.Runtime.Metrics; diff --git a/minimalproject/Packages/manifest.json b/minimalproject/Packages/manifest.json index b01ba5d497..a5f18e5544 100644 --- a/minimalproject/Packages/manifest.json +++ b/minimalproject/Packages/manifest.json @@ -1,6 +1,7 @@ { "dependencies": { - "com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects" + "com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects", + "com.unity.ide.rider": "3.0.31" }, "testables": [ "com.unity.netcode.gameobjects" diff --git a/testproject-tools-integration/Assets/Tests/Runtime/SceneEventTests.cs b/testproject-tools-integration/Assets/Tests/Runtime/SceneEventTests.cs index c5d5a17812..853d6ff7e2 100644 --- a/testproject-tools-integration/Assets/Tests/Runtime/SceneEventTests.cs +++ b/testproject-tools-integration/Assets/Tests/Runtime/SceneEventTests.cs @@ -2,13 +2,18 @@ using System.Collections; using System.Collections.Generic; using System.Linq; + using NUnit.Framework; +using UnityEngine.TestTools; + +using Unity.Collections; +using UnityEngine.SceneManagement; + using Unity.Multiplayer.Tools.MetricTypes; using Unity.Netcode; -using Unity.Netcode.TestHelpers.Runtime.Metrics; -using UnityEngine.SceneManagement; -using UnityEngine.TestTools; using Unity.Netcode.TestHelpers.Runtime; +using Unity.Netcode.TestHelpers.Runtime.Metrics; + using SceneEventType = Unity.Netcode.SceneEventType; namespace TestProject.ToolsIntegration.RuntimeTests