From dc324d8c4f208670dc5725c326d23f210128686e Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Sat, 23 Dec 2023 22:17:10 +0000 Subject: [PATCH] Only compile rust once in ci --- .github/workflows/build.yml | 12 ++++-------- test/Squirrel.Packaging.Tests/Init.cs | 4 ++++ .../WindowsPackTests.cs | 17 ++++++++--------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef1505e88..1d4194947 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,11 +37,9 @@ jobs: with: dotnet-version: 8.0.x - - name: Install .NET Tools - run: | - dotnet tool install --global nbgv - dotnet tool install --global dotnet-coverage - + - name: Install dotnet-coverage + run: dotnet tool install --global dotnet-coverage + - name: Install Rust run: rustup update stable @@ -50,9 +48,7 @@ jobs: - name: Build Rust working-directory: src/Rust - run: | - cargo build - cargo build --release + run: cargo build --release - name: Test Rust working-directory: src/Rust diff --git a/test/Squirrel.Packaging.Tests/Init.cs b/test/Squirrel.Packaging.Tests/Init.cs index dc75a3f31..d132c2535 100644 --- a/test/Squirrel.Packaging.Tests/Init.cs +++ b/test/Squirrel.Packaging.Tests/Init.cs @@ -15,7 +15,11 @@ public TestsInit(IMessageSink messageSink) { var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location.Replace("file:///", "")); var projectdir = Path.Combine(baseDir, "..", "..", "..", "..", ".."); +#if DEBUG HelperFile.AddSearchPath(Path.Combine(projectdir, "src\\Rust\\target\\debug")); +#else + HelperFile.AddSearchPath(Path.Combine(projectdir, "src\\Rust\\target\\release")); +#endif HelperFile.AddSearchPath(Path.Combine(projectdir, "vendor")); } } diff --git a/test/Squirrel.Packaging.Tests/WindowsPackTests.cs b/test/Squirrel.Packaging.Tests/WindowsPackTests.cs index a839fb0d0..f68852c62 100644 --- a/test/Squirrel.Packaging.Tests/WindowsPackTests.cs +++ b/test/Squirrel.Packaging.Tests/WindowsPackTests.cs @@ -272,11 +272,13 @@ public void TestPackedAppCanDeltaUpdateToLatest() using var _1 = Utility.GetTempDirectory(out var releaseDir); using var _2 = Utility.GetTempDirectory(out var installDir); + string id = "SquirrelIntegrationTest"; + // pack v1 - PackTestApp("1.0.0", "version 1 test", releaseDir, logger); + PackTestApp(id, "1.0.0", "version 1 test", releaseDir, logger); // install app - var setupPath1 = Path.Combine(releaseDir, $"{TEST_APP_ID}-Setup-[win-x64].exe"); + var setupPath1 = Path.Combine(releaseDir, $"{id}-Setup-[win-x64].exe"); RunProcessNoCoverage(setupPath1, new string[] { "--nocolor", "--silent", "--installto", installDir }, Environment.GetFolderPath(Environment.SpecialFolder.Desktop), logger); // check app installed correctly @@ -298,7 +300,7 @@ public void TestPackedAppCanDeltaUpdateToLatest() logger.Info("TEST: v1 output verified"); // pack v2 - PackTestApp("2.0.0", "version 2 test", releaseDir, logger); + PackTestApp(id, "2.0.0", "version 2 test", releaseDir, logger); // check can find v2 update var chk2check = RunProcess(appPath, new string[] { "check", releaseDir }, installDir, logger); @@ -306,7 +308,7 @@ public void TestPackedAppCanDeltaUpdateToLatest() logger.Info("TEST: found v2 update"); // pack v3 - PackTestApp("3.0.0", "version 3 test", releaseDir, logger); + PackTestApp(id, "3.0.0", "version 3 test", releaseDir, logger); // perform full update, check that we get v3 // apply should fail if there's not an update downloaded @@ -342,11 +344,8 @@ public void TestPackedAppCanDeltaUpdateToLatest() logger.Info("TEST: uninstalled / complete"); } - const string TEST_APP_ID = "Test.Squirrel-App"; - private string RunProcess(string exe, string[] args, string workingDir, ILogger logger, int? exitCode = 0) { - var outputfile = GetPath($"coverage.runprocess.{RandomString(8)}.xml"); var psi = new ProcessStartInfo("dotnet-coverage"); @@ -414,7 +413,7 @@ private string RunProcessNoCoverage(string exe, string[] args, string workingDir return sb.ToString().Trim(); } - private void PackTestApp(string version, string testString, string releaseDir, ILogger logger) + private void PackTestApp(string id, string version, string testString, string releaseDir, ILogger logger) { var projDir = GetPath("TestApp"); var testStringFile = Path.Combine(projDir, "Const.cs"); @@ -428,7 +427,7 @@ private void PackTestApp(string version, string testString, string releaseDir, I var options = new WindowsPackOptions { EntryExecutableName = "TestApp.exe", ReleaseDir = new DirectoryInfo(releaseDir), - PackId = TEST_APP_ID, + PackId = id, PackVersion = version, TargetRuntime = RID.Parse("win-x64"), PackDirectory = Path.Combine(projDir, "publish"),