Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Only compile rust once in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 23, 2023
1 parent bd6770a commit dc324d8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/Squirrel.Packaging.Tests/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
Expand Down
17 changes: 8 additions & 9 deletions test/Squirrel.Packaging.Tests/WindowsPackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -298,15 +300,15 @@ 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);
Assert.EndsWith(Environment.NewLine + "update: 2.0.0", chk2check);
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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand All @@ -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"),
Expand Down

0 comments on commit dc324d8

Please sign in to comment.