Only compile rust once in ci

This commit is contained in:
Caelan Sayler
2023-12-23 22:17:10 +00:00
parent bd6770a8ff
commit dc324d8c4f
3 changed files with 16 additions and 17 deletions

View File

@@ -37,11 +37,9 @@ jobs:
with: with:
dotnet-version: 8.0.x dotnet-version: 8.0.x
- name: Install .NET Tools - name: Install dotnet-coverage
run: | run: dotnet tool install --global dotnet-coverage
dotnet tool install --global nbgv
dotnet tool install --global dotnet-coverage
- name: Install Rust - name: Install Rust
run: rustup update stable run: rustup update stable
@@ -50,9 +48,7 @@ jobs:
- name: Build Rust - name: Build Rust
working-directory: src/Rust working-directory: src/Rust
run: | run: cargo build --release
cargo build
cargo build --release
- name: Test Rust - name: Test Rust
working-directory: src/Rust working-directory: src/Rust

View File

@@ -15,7 +15,11 @@ namespace Squirrel.Packaging.Tests
{ {
var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location.Replace("file:///", "")); var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location.Replace("file:///", ""));
var projectdir = Path.Combine(baseDir, "..", "..", "..", "..", ".."); var projectdir = Path.Combine(baseDir, "..", "..", "..", "..", "..");
#if DEBUG
HelperFile.AddSearchPath(Path.Combine(projectdir, "src\\Rust\\target\\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")); HelperFile.AddSearchPath(Path.Combine(projectdir, "vendor"));
} }
} }

View File

@@ -272,11 +272,13 @@ public class WindowsPackTests
using var _1 = Utility.GetTempDirectory(out var releaseDir); using var _1 = Utility.GetTempDirectory(out var releaseDir);
using var _2 = Utility.GetTempDirectory(out var installDir); using var _2 = Utility.GetTempDirectory(out var installDir);
string id = "SquirrelIntegrationTest";
// pack v1 // pack v1
PackTestApp("1.0.0", "version 1 test", releaseDir, logger); PackTestApp(id, "1.0.0", "version 1 test", releaseDir, logger);
// install app // 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); RunProcessNoCoverage(setupPath1, new string[] { "--nocolor", "--silent", "--installto", installDir }, Environment.GetFolderPath(Environment.SpecialFolder.Desktop), logger);
// check app installed correctly // check app installed correctly
@@ -298,7 +300,7 @@ public class WindowsPackTests
logger.Info("TEST: v1 output verified"); logger.Info("TEST: v1 output verified");
// pack v2 // 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 // check can find v2 update
var chk2check = RunProcess(appPath, new string[] { "check", releaseDir }, installDir, logger); var chk2check = RunProcess(appPath, new string[] { "check", releaseDir }, installDir, logger);
@@ -306,7 +308,7 @@ public class WindowsPackTests
logger.Info("TEST: found v2 update"); logger.Info("TEST: found v2 update");
// pack v3 // 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 // perform full update, check that we get v3
// apply should fail if there's not an update downloaded // apply should fail if there's not an update downloaded
@@ -342,11 +344,8 @@ public class WindowsPackTests
logger.Info("TEST: uninstalled / complete"); 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) private string RunProcess(string exe, string[] args, string workingDir, ILogger logger, int? exitCode = 0)
{ {
var outputfile = GetPath($"coverage.runprocess.{RandomString(8)}.xml"); var outputfile = GetPath($"coverage.runprocess.{RandomString(8)}.xml");
var psi = new ProcessStartInfo("dotnet-coverage"); var psi = new ProcessStartInfo("dotnet-coverage");
@@ -414,7 +413,7 @@ public class WindowsPackTests
return sb.ToString().Trim(); 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 projDir = GetPath("TestApp");
var testStringFile = Path.Combine(projDir, "Const.cs"); var testStringFile = Path.Combine(projDir, "Const.cs");
@@ -428,7 +427,7 @@ public class WindowsPackTests
var options = new WindowsPackOptions { var options = new WindowsPackOptions {
EntryExecutableName = "TestApp.exe", EntryExecutableName = "TestApp.exe",
ReleaseDir = new DirectoryInfo(releaseDir), ReleaseDir = new DirectoryInfo(releaseDir),
PackId = TEST_APP_ID, PackId = id,
PackVersion = version, PackVersion = version,
TargetRuntime = RID.Parse("win-x64"), TargetRuntime = RID.Parse("win-x64"),
PackDirectory = Path.Combine(projDir, "publish"), PackDirectory = Path.Combine(projDir, "publish"),