Skip to content

Commit

Permalink
Enable MSI testing in CI/CD pipeline (#2386)
Browse files Browse the repository at this point in the history
Build the test MSI locally and include the binary to enable the CI/CD pipeline to test installing it.
  • Loading branch information
JohnMcPMS authored Jul 29, 2022
1 parent e8f5c43 commit 2ef3510
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/actions/spelling/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ignore$
\.msix$
\.msixbundle$
\.png$
\.sln$
\.vcxitems$
\.vcxproj$
\.vcxproj\.filters$
Expand All @@ -33,6 +34,7 @@ ignore$
^src/AppInstallerCLITests/TestData/InputNames.txt$
^src/AppInstallerCLITests/TestData/InputPublishers.txt$
^src/AppInstallerCLITests/TestData/NormalizationInitialIds.txt$
^src/AppInstallerCLIE2ETests/TestData/AppInstallerTestMsiInstaller.msi$
^src/AppInstallerCommonCore/external/do.h$
^src/catch2/
^src/cpprestsdk/
Expand Down
6 changes: 6 additions & 0 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UndockedRegFreeWinRT", "Und
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Detours", "UndockedRegFreeWinRT\detours\detours.vcxproj", "{787EC629-C0FB-4BA9-9746-4A82CD06B73E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{8E43F982-40D5-4DF1-9044-C08047B5F43B}"
ProjectSection(SolutionItems) = preProject
..\templates\e2e-test.template.yml = ..\templates\e2e-test.template.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1044,6 +1049,7 @@ Global
{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9}
{31ED69A8-5310-45A9-953F-56C351D2C3E1} = {60618CAC-2995-4DF9-9914-45C6FC02C995}
{787EC629-C0FB-4BA9-9746-4A82CD06B73E} = {60618CAC-2995-4DF9-9914-45C6FC02C995}
{8E43F982-40D5-4DF1-9044-C08047B5F43B} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLIE2ETests/InstallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public void InstallZipWithInvalidRelativeFilePath()
Assert.True(result.StdOut.Contains("Invalid relative file path to the nested installer; path points to a location outside of the install directory"));
}

[Test]
[Test, Ignore("Re-enable as part of fixing #2392")]
public void InstallZipWithMsi()
{
if (string.IsNullOrEmpty(TestCommon.MsiInstallerPath))
Expand Down
18 changes: 16 additions & 2 deletions src/AppInstallerCLIE2ETests/TestCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,23 @@ public static RunCommandResult RunAICLICommandViaInvokeCommandInDesktopPackage(s

public static bool RunCommand(string fileName, string args = "", int timeOut = 60000)
{
return RunCommandWithResult(fileName, args, timeOut).ExitCode == 0;
RunCommandResult result = RunCommandWithResult(fileName, args, timeOut);

if (result.ExitCode != 0)
{
TestContext.Out.WriteLine($"Command failed with: {result.ExitCode}");
return false;
}
else
{
return true;
}
}

public static RunCommandResult RunCommandWithResult(string fileName, string args, int timeOut = 60000)
{
TestContext.Out.WriteLine($"Running command: {fileName} {args}");

Process p = new Process();
p.StartInfo = new ProcessStartInfo(fileName, args);
p.StartInfo.RedirectStandardOutput = true;
Expand Down Expand Up @@ -395,8 +407,10 @@ public static bool VerifyTestExeInstalledAndCleanup(string installDir, string ex

public static bool VerifyTestMsiInstalledAndCleanup(string installDir)
{
if (!File.Exists(Path.Combine(installDir, Constants.AppInstallerTestExeInstallerExe)))
string pathToCheck = Path.Combine(installDir, Constants.AppInstallerTestExeInstallerExe);
if (!File.Exists(pathToCheck))
{
TestContext.Out.WriteLine($"File not found: {pathToCheck}");
return false;
}

Expand Down
Binary file not shown.
9 changes: 9 additions & 0 deletions src/AppInstallerCLIE2ETests/TestData/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## AppInstallerTestMsiInstaller.msi
Due to MSI projects requiring a special extension, we have simply checked in a built version of the test MSI. To create a new one, which may be needed if the test EXE inside it needs to be updated:

1. Ensure that the extension is installed locally

a. [Microsoft Visual Studio Installer Projects 2022](https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2022InstallerProjects)
2. Set configuration to "Release|x86"
3. Build AppInstallerTestMsiInstaller project
4. Check in new MSI over the one in TestData
2 changes: 2 additions & 0 deletions templates/e2e-test.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ steps:
-LooseFileRegistration true
-InvokeCommandInDesktopPackage true
-StaticFileRootPath $(Agent.TempDirectory)\TestLocalIndex
-MsiTestInstallerPath $(System.DefaultWorkingDirectory)\src\AppInstallerCLIE2ETests\TestData\AppInstallerTestMsiInstaller.msi
-MsixTestInstallerPath $(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix
-ExeTestInstallerPath $(buildOutDir)\AppInstallerTestExeInstaller\AppInstallerTestExeInstaller.exe
-PackageCertificatePath $(AppInstallerTest.secureFilePath)'
Expand All @@ -30,6 +31,7 @@ steps:
-AICLIPath $(System.DefaultWorkingDirectory)\src\AppInstallerCLIPackage\bin\$(buildPlatform)\$(buildConfiguration)\AppInstallerCLI\winget.exe
-InvokeCommandInDesktopPackage false
-StaticFileRootPath $(Agent.TempDirectory)\TestLocalIndex
-MsiTestInstallerPath $(System.DefaultWorkingDirectory)\src\AppInstallerCLIE2ETests\TestData\AppInstallerTestMsiInstaller.msi
-MsixTestInstallerPath $(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix
-ExeTestInstallerPath $(buildOutDir)\AppInstallerTestExeInstaller\AppInstallerTestExeInstaller.exe
-PackageCertificatePath $(AppInstallerTest.secureFilePath)'

0 comments on commit 2ef3510

Please sign in to comment.