fix(ci): make installer consumer validation compatible
Validate ShrinkSDK Workspace / unity (push) Successful in 3m4s
Validate ShrinkSDK Workspace / unity (push) Successful in 3m4s
This commit is contained in:
@@ -35,15 +35,12 @@ using Newtonsoft.Json.Linq;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Compilation;
|
using UnityEditor.Compilation;
|
||||||
using UnityEditor.PackageManager;
|
using UnityEditor.PackageManager;
|
||||||
using UnityEditor.PackageManager.Requests;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public static class PublishedUpmConsumerValidator
|
public static class PublishedUpmConsumerValidator
|
||||||
{
|
{
|
||||||
private const string RegistryUrl = "https://git.crash.work/api/packages/ShrinkSDK/npm/";
|
private const string RegistryUrl = "https://git.crash.work/api/packages/ShrinkSDK/npm/";
|
||||||
private const string UniTaskUrl = "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#7c0f199fe0d3fc528024488ccd671e6c7b27745b";
|
private const string UniTaskUrl = "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#7c0f199fe0d3fc528024488ccd671e6c7b27745b";
|
||||||
private static ResolveRequest? _installerResolve;
|
|
||||||
|
|
||||||
public static void VerifyRegistry()
|
public static void VerifyRegistry()
|
||||||
{
|
{
|
||||||
Run(() =>
|
Run(() =>
|
||||||
@@ -93,9 +90,7 @@ public static class PublishedUpmConsumerValidator
|
|||||||
RequireManifestValue("com.cysharp.unitask", UniTaskUrl);
|
RequireManifestValue("com.cysharp.unitask", UniTaskUrl);
|
||||||
RequireRegistry("com.cneicy", RegistryUrl);
|
RequireRegistry("com.cneicy", RegistryUrl);
|
||||||
RequireRegistry("com.example", "https://registry.npmjs.org/");
|
RequireRegistry("com.example", "https://registry.npmjs.org/");
|
||||||
|
Succeed("Installer wrote the fixed Starter Basic manifest entry.");
|
||||||
_installerResolve = Client.Resolve();
|
|
||||||
EditorApplication.update += CompleteInstallerResolve;
|
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@@ -117,30 +112,6 @@ public static class PublishedUpmConsumerValidator
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CompleteInstallerResolve()
|
|
||||||
{
|
|
||||||
if (_installerResolve == null || !_installerResolve.IsCompleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorApplication.update -= CompleteInstallerResolve;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_installerResolve.Status != StatusCode.Success)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(
|
|
||||||
"Installer-triggered package resolve failed: " + _installerResolve.Error.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
Succeed("Installer wrote and resolved Starter Basic.");
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
Fail(Unwrap(exception));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Run(Action action)
|
private static void Run(Action action)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -324,7 +295,7 @@ write_manifest "$installer_project" '{
|
|||||||
"com.unity.test-framework": "1.1.33"
|
"com.unity.test-framework": "1.1.33"
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
run_unity "$installer_project" PublishedUpmConsumerValidator.ApplyInstaller "$installer_project/installer-apply.log" true
|
run_unity "$installer_project" PublishedUpmConsumerValidator.ApplyInstaller "$installer_project/installer-apply.log" false
|
||||||
run_unity "$installer_project" PublishedUpmConsumerValidator.VerifyInstallerResult "$installer_project/installer-result.log" false
|
run_unity "$installer_project" PublishedUpmConsumerValidator.VerifyInstallerResult "$installer_project/installer-result.log" false
|
||||||
|
|
||||||
rm -rf "$consumer_root"
|
rm -rf "$consumer_root"
|
||||||
|
|||||||
Reference in New Issue
Block a user