mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Merge pull request #1809 from Squirrel/robmen/testing
Integrate master changes and tests in CI
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -31,6 +31,10 @@ jobs:
|
||||
shell: cmd
|
||||
run: ./src/build_official.cmd
|
||||
|
||||
- name: Test Squirrel
|
||||
shell: cmd
|
||||
run: ./test/test_official.cmd
|
||||
|
||||
- name: Save build
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
||||
@@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.28803.352
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrel", "src\Squirrel\Squirrel.csproj", "{1436E22A-FE3C-4D68-9A85-9E74DF2E6A92}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrel.Tests", "test\Squirrel.Tests.csproj", "{98AEB048-E27D-42F4-9440-505B7F78BAFD}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrel.Tests", "test\Squirrel.Tests\Squirrel.Tests.csproj", "{98AEB048-E27D-42F4-9440-505B7F78BAFD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Setup", "src\Setup\Setup.vcxproj", "{C1D40624-A484-438A-B846-052F321C89D1}"
|
||||
EndProject
|
||||
|
||||
@@ -34,7 +34,7 @@ Section [NuGet Package Metadata](../using/nuget-package-metadata.md) provides ad
|
||||
3. **Add lib & net45** - add the `lib` folder and the `net45` folder to the project. Squirrel is expecting a single `lib / net45` directory provided regardless of whether your app is a `net45` application.
|
||||
4. **Add Release Files** - add all the files from `bin\Release` needed by MyApp to execute (including the various files required by Squirrel).
|
||||
* **Include MyApp Files:** MyApp.exe, MyApp.exe.config, any non-standard .NET dll's needed by MyApp.exe.
|
||||
* **Include Squirrel Files:** Squirrel.dll, Splat.dll, NuGet.Squirrel.dll, Mono.Cecil.\*, DeltaCompressionDotNet.\*, ICSharpCode.SharpZipLib.\*
|
||||
* **Include Squirrel Files:** Squirrel.dll, Splat.dll, NuGet.Squirrel.dll, Mono.Cecil.\*, DeltaCompressionDotNet.\*,
|
||||
* **Exclude:** *.vshost.\*, *.pdb files
|
||||
5. **Save the NuGet Package File** - save the NuGet package file to where you can easily access later (e.g., `MyApp.sln` directory). Follow the given naming format (e.g., `MyApp.1.0.0.nupkg`).
|
||||
|
||||
|
||||
@@ -1,24 +1,36 @@
|
||||
| [docs](..) / [using](.) / machine-wide-installs.md
|
||||
|:---|
|
||||
|
||||
|
||||
| [docs](..) / [using](.) / machine-wide-installs.md
|
||||
|:---|
|
||||
|
||||
|
||||
# Machine-wide Installs
|
||||
|
||||
Squirrel's Releasify command generates an MSI file suitable for installation via Group Policy. This MSI isn't a general-purpose installer, this means that once you run the MSI, users from now on will get the app installed, on next Login.
|
||||
|
||||
So, most normal users should continue to run the Setup.exe's generated by Releasify, but if you want to have an IT Admin Friendly version, you can hand off the MSI
|
||||
|
||||
Most users of Squirrel won't have to do anything new to enable this behavior, though certain NuGet package IDs / names might cause problems with MSI.
|
||||
|
||||
**Source:** See [issue #466](https://github.com/Squirrel/Squirrel.Windows/issues/466) for more details.
|
||||
|
||||
### Disabling MSI Generation
|
||||
Generating MSIs can be disabled via the --no-msi flag as shown below:
|
||||
|
||||
~~~powershell
|
||||
PM> Squirrel --releasify MyApp.1.0.0.nupkg --no-msi
|
||||
~~~
|
||||
|
||||
---
|
||||
| Return: [Table of Contents](../readme.md) |
|
||||
|----|
|
||||
|
||||
Squirrel's Releasify command generates an MSI file suitable for installation via Group Policy. This MSI isn't a general-purpose installer, this means that once you run the MSI, users from now on will get the app installed, on next Login.
|
||||
|
||||
So, most normal users should continue to run the Setup.exe's generated by Releasify, but if you want to have an IT Admin Friendly version, you can hand off the MSI
|
||||
|
||||
## Common pitfalls
|
||||
|
||||
### Missing data in `.nuspec`
|
||||
|
||||
Most users of Squirrel won't have to do anything new to enable this behavior, though certain NuGet package IDs / names might cause problems with MSI.
|
||||
|
||||
**Source:** See [issue #466](https://github.com/Squirrel/Squirrel.Windows/issues/466) for more details.
|
||||
|
||||
### Nothing happens on login
|
||||
|
||||
In cases where the end user has previously installed your application, the installer that runs on login will not re-install your application on every login. This can easily be the case if you as a developer is testing out both the EXE and the MSI.
|
||||
|
||||
Squirrel leaves behind an almost-empty `%LocalAppData%\MyApp` folder after an uninstall. Deleting this folder (the entire folder, not just the contents) will allow the installer that runs on login to install successfully.
|
||||
|
||||
**Source:**: See [issue #555](https://github.com/Squirrel/Squirrel.Windows/issues/555#issuecomment-253265130) for details.
|
||||
|
||||
## Disabling MSI Generation
|
||||
Generating MSIs can be disabled via the --no-msi flag as shown below:
|
||||
|
||||
~~~powershell
|
||||
PM> Squirrel --releasify MyApp.1.0.0.nupkg --no-msi
|
||||
~~~
|
||||
|
||||
---
|
||||
| Return: [Table of Contents](../readme.md) |
|
||||
|----|
|
||||
|
||||
@@ -240,11 +240,14 @@ namespace Squirrel.Bsdiff
|
||||
long diffEndPosition = output.Position;
|
||||
WriteInt64(diffEndPosition - controlEndPosition, header, 16);
|
||||
|
||||
// write compressed extra data
|
||||
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress))
|
||||
// write compressed extra data, if any
|
||||
if (eblen > 0)
|
||||
{
|
||||
bz2Stream.Write(eb, 0, eblen);
|
||||
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress))
|
||||
{
|
||||
bz2Stream.Write(eb, 0, eblen);
|
||||
}
|
||||
}
|
||||
|
||||
// seek to the beginning, write the header, then seek back to end
|
||||
@@ -326,10 +329,13 @@ namespace Squirrel.Bsdiff
|
||||
compressedDiffStream.Seek(c_headerSize + controlLength, SeekOrigin.Current);
|
||||
compressedExtraStream.Seek(c_headerSize + controlLength + diffLength, SeekOrigin.Current);
|
||||
|
||||
// the stream might end here if there is no extra data
|
||||
var hasExtraData = compressedExtraStream.Position < compressedExtraStream.Length;
|
||||
|
||||
// decompress each part (to read it)
|
||||
using (var controlStream = new BZip2Stream(compressedControlStream, CompressionMode.Decompress))
|
||||
using (var diffStream = new BZip2Stream(compressedDiffStream, CompressionMode.Decompress))
|
||||
using (var extraStream = new BZip2Stream(compressedExtraStream, CompressionMode.Decompress))
|
||||
using (var extraStream = hasExtraData ? new BZip2Stream(compressedExtraStream, CompressionMode.Decompress) : null)
|
||||
{
|
||||
long[] control = new long[3];
|
||||
byte[] buffer = new byte[8];
|
||||
|
||||
@@ -601,7 +601,7 @@ namespace Squirrel.Update
|
||||
String.Format("sign {0} \"{1}\"", signingOpts, exePath), CancellationToken.None);
|
||||
|
||||
if (processResult.Item1 != 0) {
|
||||
var optsWithPasswordHidden = new Regex(@"/p\s+\w+").Replace(signingOpts, "/p ********");
|
||||
var optsWithPasswordHidden = new Regex(@"/p\s+\S+").Replace(signingOpts, "/p ********");
|
||||
var msg = String.Format("Failed to sign, command invoked was: '{0} sign {1} {2}'",
|
||||
exe, optsWithPasswordHidden, exePath);
|
||||
|
||||
|
||||
@@ -4,16 +4,16 @@ setlocal
|
||||
pushd %~dp0
|
||||
|
||||
:parse_args
|
||||
@if not "%1"=="" shift & goto parse_args
|
||||
if not "%1"=="" shift & goto parse_args
|
||||
|
||||
:: Init
|
||||
|
||||
@if "%VCToolsVersion%"=="" call :StartDeveloperCommandPrompt || exit /b
|
||||
if "%VCToolsVersion%"=="" call :StartDeveloperCommandPrompt || exit /b
|
||||
|
||||
|
||||
:: Clean
|
||||
|
||||
rd /s /q ..\build ..\packages ..\test\obj ..\test\bin 2> nul
|
||||
rd /s /q ..\build ..\packages 2> nul
|
||||
|
||||
|
||||
:: Build
|
||||
|
||||
8
test/Directory.Build.props
Normal file
8
test/Directory.Build.props
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Import Project="..\src\Directory.Build.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputPath>$(BaseOutputPath)$(Configuration)\test\</OutputPath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -10,8 +10,8 @@ namespace Squirrel.Tests
|
||||
public class ApplyReleasesProgressTests
|
||||
{
|
||||
|
||||
[Fact]
|
||||
public async void CalculatesPercentageCorrectly()
|
||||
[Fact(Skip = "Test does not pass consistently due to dependency on Task.Delay()")]
|
||||
public async Task CalculatesPercentageCorrectly()
|
||||
{
|
||||
// Just 1 complex situation should be enough to cover this
|
||||
|
||||
@@ -290,5 +290,28 @@ namespace Squirrel.Tests.Core
|
||||
tempFiles.ForEach(File.Delete);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HandleBsDiffWithoutExtraData()
|
||||
{
|
||||
var baseFileData = new byte[] { 1, 1, 1, 1 };
|
||||
var newFileData = new byte[] { 2, 1, 1, 1 };
|
||||
|
||||
byte[] patchData;
|
||||
|
||||
using (var patchOut = new MemoryStream())
|
||||
{
|
||||
Bsdiff.BinaryPatchUtility.Create(baseFileData, newFileData, patchOut);
|
||||
patchData = patchOut.ToArray();
|
||||
}
|
||||
|
||||
using (var toPatch = new MemoryStream(baseFileData))
|
||||
using (var patched = new MemoryStream())
|
||||
{
|
||||
Bsdiff.BinaryPatchUtility.Apply(toPatch, () => new MemoryStream(patchData), patched);
|
||||
|
||||
Assert.Equal(newFileData, patched.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\Squirrel\Squirrel.csproj" />
|
||||
<ProjectReference Include="..\vendor\nuget\src\Core\Core.csproj" />
|
||||
<None Include="fixtures\**" CopyToOutputDirectory="PreserveNewest" />
|
||||
<None Include="..\..\.nuget\nuget.exe" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Squirrel\Squirrel.csproj" />
|
||||
<ProjectReference Include="..\..\vendor\nuget\src\Core\Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -15,11 +15,11 @@ namespace Squirrel.Tests
|
||||
public class SquirrelAwareExecutableDetectorTests
|
||||
{
|
||||
#if DEBUG
|
||||
private const string NativeBuildRootRelativePath = @"..\build\Debug\Win32\";
|
||||
private const string ManagedBuildRootRelativePath = @"..\build\Debug\net45\";
|
||||
private const string NativeBuildRootRelativePath = @"..\..\Win32\";
|
||||
private const string ManagedBuildRootRelativePath = @"..\..\net45\";
|
||||
#else
|
||||
private const string NativeBuildRootRelativePath = @"..\build\Release\Win32\";
|
||||
private const string ManagedBuildRootRelativePath = @"..\build\Release\net45\";
|
||||
private const string NativeBuildRootRelativePath = @"..\..\Win32\";
|
||||
private const string ManagedBuildRootRelativePath = @"..\..\net45\";
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
@@ -11,6 +11,7 @@ using System.Text;
|
||||
using SharpCompress.Archives.Zip;
|
||||
using SharpCompress.Readers;
|
||||
using SharpCompress.Common;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Squirrel.Tests.TestHelpers
|
||||
{
|
||||
@@ -24,13 +25,7 @@ namespace Squirrel.Tests.TestHelpers
|
||||
|
||||
public static string GetIntegrationTestRootDirectory()
|
||||
{
|
||||
// XXX: This is an evil hack, but it's okay for a unit test
|
||||
// We can't use Assembly.Location because unit test runners love
|
||||
// to move stuff to temp directories
|
||||
var st = new StackFrame(true);
|
||||
var di = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(st.GetFileName()), ".."));
|
||||
|
||||
return di.FullName;
|
||||
return Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath);
|
||||
}
|
||||
|
||||
public static bool SkipTestOnXPAndVista()
|
||||
@@ -76,7 +71,7 @@ namespace Squirrel.Tests.TestHelpers
|
||||
{
|
||||
var targetDir = default(string);
|
||||
|
||||
var nuget = IntegrationTestHelper.GetPath("..", ".nuget", "nuget.exe");
|
||||
var nuget = IntegrationTestHelper.GetPath("nuget.exe");
|
||||
nuspecFile = nuspecFile ?? "SquirrelInstalledApp.nuspec";
|
||||
|
||||
using (var clearTemp = Utility.WithTempDirectory(out targetDir)) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user