Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify creating local index #3445

Merged
merged 30 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ASwitch
ASYNCRTIMP
Atest
ATL
attr
AType
AUrl
Authenticode
Expand All @@ -56,6 +57,7 @@ boundparms
bpp
Browsable
BSODs
BUILDOUTDIR
buildtransitive
BUILTINS
cancelledbyuser
Expand Down Expand Up @@ -121,6 +123,7 @@ ENDSESSION
EQU
errmsg
ERRORONEXIT
ESource
ESRB
etest
etl
Expand Down Expand Up @@ -224,6 +227,7 @@ Linq
liv
liwpx
localizationpriority
localsource
LOWORD
LPARAM
LPBYTE
Expand Down Expand Up @@ -394,6 +398,7 @@ rzkzqaqjwj
SARL
schematab
sddl
SECUREFILEPATH
seof
servercert
servercertificate
Expand All @@ -410,6 +415,7 @@ SLAPI
SMTO
sortof
sourceforge
SOURCESDIRECTORY
spamming
SPAPI
Srinivasan
Expand All @@ -434,6 +440,7 @@ systemnotsupported
Tagit
TCpp
tcs
TEMPDIRECTORY
Templating
temppath
testdata
Expand Down Expand Up @@ -476,9 +483,9 @@ userfilesetting
userprofile
UWP
VALUENAMECASE
vclib
VERSI
VERSIE
vclib
vns
vsconfig
vstest
Expand Down
50 changes: 19 additions & 31 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,6 @@ jobs:
testResultsFiles: '$(artifactsDir)\TEST-*.xml'
failTaskOnFailedTests: true

- task: DownloadSecureFile@1
name: AppInstallerTest
displayName: 'Download Source Package Certificate'
inputs:
secureFile: 'AppInstallerTest.pfx'

- task: DownloadSecureFile@1
name: HTTPSDevCert
displayName: 'Download Kestrel Certificate'
inputs:
secureFile: 'HTTPSDevCertV2.pfx'

- task: MSBuild@1
displayName: Build MSIX Test Installer File
inputs:
Expand All @@ -201,18 +189,6 @@ jobs:
/p:UapAppxPackageBuildMode=SideLoadOnly
/p:AppxPackageSigningEnabled=false'

- task: PowerShell@2
displayName: Install Root Certificate
inputs:
filePath: 'src\LocalhostWebServer\InstallDevCert.ps1'
arguments: '-pfxpath $(HTTPSDevCert.secureFilePath) -password microsoft'

- task: PowerShell@2
displayName: Launch LocalhostWebServer
inputs:
filePath: 'src\LocalhostWebServer\Run-LocalhostWebServer.ps1'
arguments: '-BuildRoot $(buildOutDir)\LocalhostWebServer -StaticFileRoot $(Agent.TempDirectory)\TestLocalIndex -CertPath $(HTTPSDevCert.secureFilePath) -CertPassword microsoft'

- task: PowerShell@2
displayName: 'Set program files directory'
inputs:
Expand Down Expand Up @@ -240,12 +216,10 @@ jobs:
TargetFolder: '$(platformProgramFiles)\dotnet'
Contents: Microsoft.Management.Deployment.winmd

- task: PowerShell@2
displayName: Setup Local PS Repository
inputs:
filePath: 'src\AppInstallerCLIE2ETests\TestData\Configuration\Init-TestRepository.ps1'
arguments: '-Force'
pwsh: true
- template: templates/e2e-setup.yml
parameters:
source: $(Build.SourcesDirectory)
buildOutDir: $(buildOutDir)

- template: templates/e2e-test.template.yml
parameters:
Expand All @@ -269,7 +243,21 @@ jobs:
displayName: 'Copy E2E Tests Package Log to artifacts folder'
inputs:
SourceFolder: '$(temp)\E2ETestLogs'
TargetFolder: '$(artifactsDir)\E2ETestsPackagedLog'
TargetFolder: '$(artifactsDir)\E2ETests\PackagedLog'
condition: succeededOrFailed()

- task: CopyFiles@2
displayName: 'Copy E2E Test Source'
inputs:
SourceFolder: '$(Agent.TempDirectory)\TestLocalIndex'
TargetFolder: '$(artifactsDir)\E2ETests\TestLocalIndex'
condition: succeededOrFailed()

- task: CopyFiles@2
displayName: 'Copy TestData'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\src\AppInstallerCLIE2ETests\TestData\'
TargetFolder: '$(artifactsDir)\E2ETests\TestData'
condition: succeededOrFailed()

- task: CopyFiles@2
Expand Down
32 changes: 32 additions & 0 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Management.Config
{2B00D362-AC92-41F3-A8D2-5B1599BDCA01} = {2B00D362-AC92-41F3-A8D2-5B1599BDCA01}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinGetSourceCreator", "WinGetSourceCreator\WinGetSourceCreator.csproj", "{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Expand Down Expand Up @@ -1166,6 +1168,36 @@ Global
{2268D5AD-7F2A-485A-8C4B-C574497514C9}.TestRelease|x64.Build.0 = Release|x64
{2268D5AD-7F2A-485A-8C4B-C574497514C9}.TestRelease|x86.ActiveCfg = Release|Win32
{2268D5AD-7F2A-485A-8C4B-C574497514C9}.TestRelease|x86.Build.0 = Release|Win32
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Debug|ARM64.Build.0 = Debug|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Debug|x64.ActiveCfg = Debug|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Debug|x64.Build.0 = Debug|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Debug|x86.Build.0 = Debug|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Fuzzing|ARM64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Fuzzing|ARM64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Fuzzing|x64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Fuzzing|x64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Fuzzing|x86.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Fuzzing|x86.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.PowerShell|ARM64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.PowerShell|ARM64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.PowerShell|x64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.PowerShell|x64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.PowerShell|x86.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.PowerShell|x86.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Release|ARM64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Release|ARM64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Release|x64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Release|x64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Release|x86.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.Release|x86.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.TestRelease|ARM64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.TestRelease|ARM64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.TestRelease|x64.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.TestRelease|x64.Build.0 = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.TestRelease|x86.ActiveCfg = Release|Any CPU
{52EC37D6-088C-40D3-AD0B-BDE8F8DAF9EB}.TestRelease|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCLIE2ETests/AppInstallerCLIE2ETests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<None Remove="testdata\configuration\ResourcesNotASequence.yml" />
<None Remove="testdata\configuration\UnitNotAMap.yml" />
<None Remove="testdata\configuration\UnknownVersion.yml" />
<None Remove="TestData\localsource.json" />
</ItemGroup>

<ItemGroup>
Expand All @@ -80,6 +81,7 @@
<ProjectReference Include="..\WindowsPackageManager\WindowsPackageManager.vcxproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\WinGetSourceCreator\WinGetSourceCreator.csproj" />
<ProjectReference Include="..\WinGetUtil\WinGetUtil.vcxproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
Expand Down
19 changes: 10 additions & 9 deletions src/AppInstallerCLIE2ETests/AppShutdownTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ namespace AppInstallerCLIE2ETests
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;

/// <summary>
/// `test appshutdown` command tests.
/// </summary>
public class AppShutdownTests : BaseCommand
public class AppShutdownTests
{
/// <summary>
/// Runs winget test appshutdown and register the application to force a WM_QUERYENDSESSION message.
Expand All @@ -25,17 +26,17 @@ public class AppShutdownTests : BaseCommand
[Ignore("This test won't work on Window Server")]
public void RegisterApplicationTest()
{
if (!TestCommon.PackagedContext)
if (!TestSetup.Parameters.PackagedContext)
{
return;
Assert.Ignore("Not packaged context.");
}

if (string.IsNullOrEmpty(TestCommon.AICLIPackagePath))
if (string.IsNullOrEmpty(TestSetup.Parameters.AICLIPackagePath))
{
throw new NullReferenceException("AICLIPackagePath");
}

var appxManifest = Path.Combine(TestCommon.AICLIPackagePath, "AppxManifest.xml");
var appxManifest = Path.Combine(TestSetup.Parameters.AICLIPackagePath, "AppxManifest.xml");
if (!File.Exists(appxManifest))
{
throw new FileNotFoundException(appxManifest);
Expand Down Expand Up @@ -73,7 +74,7 @@ public void RegisterApplicationTest()
// Register the app with the updated version.
var registerTask = new Task<bool>(() =>
{
return TestCommon.InstallMsixRegister(TestCommon.AICLIPackagePath, true, false);
return TestCommon.InstallMsixRegister(TestSetup.Parameters.AICLIPackagePath, true, false);
});

// Give it a little time.
Expand All @@ -97,12 +98,12 @@ public void RegisterApplicationTest()
[Test]
public void RegisterApplicationTest_Force()
{
if (!TestCommon.PackagedContext)
if (!TestSetup.Parameters.PackagedContext)
{
return;
Assert.Ignore("Not packaged context.");
}

if (string.IsNullOrEmpty(TestCommon.AICLIPackagePath))
if (string.IsNullOrEmpty(TestSetup.Parameters.AICLIPackagePath))
{
throw new NullReferenceException("AICLIPackagePath");
}
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace AppInstallerCLIE2ETests
{
using System;
using System.IO;
using AppInstallerCLIE2ETests.Helpers;
using Newtonsoft.Json.Linq;
using NUnit.Framework;

Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/ConfigureCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace AppInstallerCLIE2ETests
{
using System.IO;
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/ConfigureShowCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace AppInstallerCLIE2ETests
{
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/ConfigureTestCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace AppInstallerCLIE2ETests
{
using System.IO;
using AppInstallerCLIE2ETests.Helpers;
using Microsoft.Management.Infrastructure;
using NUnit.Framework;

Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/ConfigureValidateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace AppInstallerCLIE2ETests
{
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions src/AppInstallerCLIE2ETests/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public class Constants
public const string LooseFileRegistrationParameter = "LooseFileRegistration";
public const string InvokeCommandInDesktopPackageParameter = "InvokeCommandInDesktopPackage";
public const string StaticFileRootPathParameter = "StaticFileRootPath";
public const string LocalServerCertPathParameter = "LocalServerCertPath";
public const string ExeInstallerPathParameter = "ExeTestInstallerPath";
public const string MsiInstallerPathParameter = "MsiTestInstallerPath";
public const string MsixInstallerPathParameter = "MsixTestInstallerPath";
public const string PackageCertificatePathParameter = "PackageCertificatePath";
public const string PowerShellModulePathParameter = "PowerShellModulePath";
public const string AppInstallerTestCert = "AppInstallerTest.cer";
public const string AppInstallerTestCertThumbprint = "d03e7a688b388b1edde8476a627531c49db88017";
public const string SkipTestSourceParameter = "SkipTestSource";

// Test Sources
public const string DefaultWingetSourceName = @"winget";
Expand All @@ -42,7 +42,9 @@ public class Constants
public const string TestSourceUrl = @"https://localhost:5001/TestKit";
public const string TestSourceType = "Microsoft.PreIndexed.Package";
public const string TestSourceIdentifier = @"WingetE2E.Tests_8wekyb3d8bbwe";
public const string TestSourceServerCertificateFileName = "servercert.cer";

public const string AppInstallerTestCert = "AppInstallerTest.cer";
public const string AppInstallerTestCertThumbprint = "d03e7a688b388b1edde8476a627531c49db88017";

public const string AICLIPackageFamilyName = "WinGetDevCLI_8wekyb3d8bbwe";
public const string AICLIPackageName = "WinGetDevCLI";
Expand Down
3 changes: 2 additions & 1 deletion src/AppInstallerCLIE2ETests/DownloadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

namespace AppInstallerCLIE2ETests
{
using System.IO;
using System.IO;
using AppInstallerCLIE2ETests.Helpers;
using Microsoft.Management.Deployment;
using NUnit.Framework;
using Windows.System;
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/FeaturesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace AppInstallerCLIE2ETests
{
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/GroupPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace AppInstallerCLIE2ETests
{
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/GroupPolicyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace AppInstallerCLIE2ETests
using System.IO;
using System.Linq;
using System.Xml.Linq;
using AppInstallerCLIE2ETests.Helpers;
using Microsoft.Win32;
using Newtonsoft.Json;
using NUnit.Framework;
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLIE2ETests/HashCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace AppInstallerCLIE2ETests
{
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;
using NUnit.Framework.Internal;

Expand Down
Loading
Loading