diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index deb41ab..db41681 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,7 @@ jobs: - name: Install and Configure Keyring if: ${{ matrix.os == 'ubuntu-latest' }} run: | + sudo apt-get update sudo apt-get install -y gnome-keyring export $(dbus-launch --sh-syntax) export $(echo 'anypass_just_to_unlock' | gnome-keyring-daemon --unlock) @@ -54,7 +55,7 @@ jobs: name: test-results-${{ matrix.os }} path: TestResults/*.trx - name: Install ReportGenerator - run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.4.4 + run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.4.11 - name: Merge code coverage files run: reportgenerator "-reports:${{ github.workspace }}/**/*.cobertura.xml" "-targetdir:${{ github.workspace }}/report" "-reporttypes:Cobertura" "-filefilters:-*GenerationContext*.g.cs" - name: Publish code coverage results diff --git a/.pipelines/templates/build-nuget.yaml b/.pipelines/templates/build-nuget.yaml index b508aec..5b59bc1 100644 --- a/.pipelines/templates/build-nuget.yaml +++ b/.pipelines/templates/build-nuget.yaml @@ -17,6 +17,7 @@ steps: - bash: | echo "##vso[task.setvariable variable=AgentOS;]${{ parameters.AgentOS }}" - script: | + sudo apt-get update sudo apt-get install -y gnome-keyring dbus-x11 eval "$(dbus-launch --sh-syntax)" echo "##vso[task.setvariable variable=DBUS_SESSION_BUS_ADDRESS;]$DBUS_SESSION_BUS_ADDRESS" @@ -66,7 +67,7 @@ steps: inputs: command: custom custom: tool - arguments: 'install --global dotnet-reportgenerator-globaltool --version 5.4.4' + arguments: 'install --global dotnet-reportgenerator-globaltool --version 5.4.11' - script: reportgenerator "-reports:$(Build.SourcesDirectory)/**/*.cobertura.xml" "-targetdir:$(Build.SourcesDirectory)/report" "-reporttypes:Cobertura" "-filefilters:-*GenerationContext*.g.cs" displayName: Merge code coverage files - task: PublishCodeCoverageResults@1 diff --git a/MSStore.API/MSStore.API.csproj b/MSStore.API/MSStore.API.csproj index 44c9906..979416e 100644 --- a/MSStore.API/MSStore.API.csproj +++ b/MSStore.API/MSStore.API.csproj @@ -21,9 +21,9 @@ - - - + + + diff --git a/MSStore.CLI.UnitTests/MSStore.CLI.UnitTests.csproj b/MSStore.CLI.UnitTests/MSStore.CLI.UnitTests.csproj index 41abd5f..9df47de 100644 --- a/MSStore.CLI.UnitTests/MSStore.CLI.UnitTests.csproj +++ b/MSStore.CLI.UnitTests/MSStore.CLI.UnitTests.csproj @@ -1,4 +1,4 @@ - + net9.0;net9.0-windows10.0.17763.0 @@ -44,22 +44,22 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/MSStore.CLI.UnitTests/ProjectConfiguratorTests.cs b/MSStore.CLI.UnitTests/ProjectConfiguratorTests.cs index f86de4c..8d7d1a4 100644 --- a/MSStore.CLI.UnitTests/ProjectConfiguratorTests.cs +++ b/MSStore.CLI.UnitTests/ProjectConfiguratorTests.cs @@ -8,6 +8,8 @@ namespace MSStore.CLI.UnitTests [TestClass] public class ProjectConfiguratorTests : BaseCommandLineTest { + public TestContext TestContext { get; set; } + [TestInitialize] public void Init() { @@ -73,7 +75,7 @@ public async Task ProjectConfiguratorParsesFlutterProject() result.Error.Should().Contain("This seems to be a Flutter project."); result.Error.Should().Contain("is now configured to build to the Microsoft Store!"); - var pubspecYamlFileContents = await File.ReadAllTextAsync(Path.Combine(path, "pubspec.yaml")); + var pubspecYamlFileContents = await File.ReadAllTextAsync(Path.Combine(path, "pubspec.yaml"), TestContext.CancellationTokenSource.Token); pubspecYamlFileContents.Should().Contain("msix"); } @@ -138,7 +140,7 @@ public async Task ProjectConfiguratorParsesAlreadyConfiguredFlutterProject() result.Error.Should().Contain("This seems to be a Flutter project."); result.Error.Should().Contain("is now configured to build to the Microsoft Store!"); - var pubspecYamlFileContents = await File.ReadAllTextAsync(Path.Combine(path, "pubspec.yaml")); + var pubspecYamlFileContents = await File.ReadAllTextAsync(Path.Combine(path, "pubspec.yaml"), TestContext.CancellationTokenSource.Token); pubspecYamlFileContents.Should().Contain("msix"); } @@ -194,7 +196,7 @@ public async Task ProjectConfiguratorParsesElectronNpmProject() result.Error.Should().Contain("This seems to be a Electron project."); result.Error.Should().Contain("is now configured to build to the Microsoft Store!"); - var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json")); + var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json"), TestContext.CancellationTokenSource.Token); packageJsonFileContents.Should().Contain("appx"); } @@ -237,7 +239,7 @@ public async Task ProjectConfiguratorParsesAlreadyConfiguredElectronNpmProject() result.Error.Should().Contain("This seems to be a Electron project."); result.Error.Should().Contain("is now configured to build to the Microsoft Store!"); - var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json")); + var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json"), TestContext.CancellationTokenSource.Token); packageJsonFileContents.Should().Contain("appx"); } @@ -293,7 +295,7 @@ public async Task ProjectConfiguratorParsesElectronYarnProject() result.Error.Should().Contain("This seems to be a Electron project."); result.Error.Should().Contain("is now configured to build to the Microsoft Store!"); - var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json")); + var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json"), TestContext.CancellationTokenSource.Token); packageJsonFileContents.Should().Contain("appx"); } @@ -336,7 +338,7 @@ public async Task ProjectConfiguratorParsesAlreadyConfiguredElectronYarnProject( result.Error.Should().Contain("This seems to be a Electron project."); result.Error.Should().Contain("is now configured to build to the Microsoft Store!"); - var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json")); + var packageJsonFileContents = await File.ReadAllTextAsync(Path.Combine(path, "package.json"), TestContext.CancellationTokenSource.Token); packageJsonFileContents.Should().Contain("appx"); } @@ -458,7 +460,7 @@ private async Task ValidateReactNativeAppxManifestWasUpdatedAsync(string path) var dir = new DirectoryInfo(Path.Combine(path, "windows")); dir.GetDirectories().Should().HaveCount(1); var projectDir = dir.GetDirectories()[0]; - var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(projectDir.FullName, "Package.appxmanifest")); + var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(projectDir.FullName, "Package.appxmanifest"), TestContext.CancellationTokenSource.Token); appxManifestFileContents.Should().Contain(FakeApps[0].Id); appxManifestFileContents.Should().Contain(FakeApps[0].PrimaryName); @@ -483,7 +485,7 @@ public async Task ProjectConfiguratorParsesUWPProject() result.Error.Should().Contain("This seems to be a UWP project."); - var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(path, "Package.appxmanifest")); + var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(path, "Package.appxmanifest"), TestContext.CancellationTokenSource.Token); appxManifestFileContents.Should().Contain("Fake App"); } @@ -511,7 +513,7 @@ public async Task ProjectConfiguratorParsesWinUIProject() result.Error.Should().Contain("This seems to be a Windows App SDK/WinUI project."); - var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(path, "Package.appxmanifest")); + var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(path, "Package.appxmanifest"), TestContext.CancellationTokenSource.Token); appxManifestFileContents.Should().Contain("Fake App"); } @@ -539,11 +541,11 @@ public async Task ProjectConfiguratorParsesMauiProject() result.Error.Should().Contain("This seems to be a Maui project."); - var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(path, "Platforms", "Windows", "Package.appxmanifest")); + var appxManifestFileContents = await File.ReadAllTextAsync(Path.Combine(path, "Platforms", "Windows", "Package.appxmanifest"), TestContext.CancellationTokenSource.Token); appxManifestFileContents.Should().Contain("9PN3ABCDEFGA"); - var csprojFileContents = await File.ReadAllTextAsync(Path.Combine(path, "MauiApp.csproj")); + var csprojFileContents = await File.ReadAllTextAsync(Path.Combine(path, "MauiApp.csproj"), TestContext.CancellationTokenSource.Token); csprojFileContents.Should().Contain("Fake App"); } diff --git a/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs b/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs index 08aac58..98342a8 100644 --- a/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs +++ b/MSStore.CLI.UnitTests/PublishCommandUnitTests.cs @@ -8,6 +8,8 @@ namespace MSStore.CLI.UnitTests [TestClass] public class PublishCommandUnitTests : BaseCommandLineTest { + public TestContext TestContext { get; set; } + [TestInitialize] public void Init() { @@ -37,7 +39,7 @@ public async Task PublishCommandForUWPAppsShouldCallMSBuildIfWindows() AppXManifestManager.Object.UpdateManifest(Path.Combine(path, "Package.appxmanifest"), FakeApps[0], "publisher", null); var appPackagesFolder = Directory.CreateDirectory(Path.Combine(path, "AppPackages")); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.msixupload"), string.Empty); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.msixupload"), string.Empty, TestContext.CancellationTokenSource.Token); AddDefaultFakeSuccessfulSubmission(); @@ -66,8 +68,8 @@ public async Task PublishCommandForWinUIAppsShouldCallMSBuildIfWindows() var appPackagesFolderX64 = Directory.CreateDirectory(Path.Combine(path, "AppPackages", "x64")); var appPackagesFolderArm64 = Directory.CreateDirectory(Path.Combine(path, "AppPackages", "arm64")); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolderX64.FullName, "test_x64.msix"), string.Empty); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolderArm64.FullName, "test_arm64.msix"), string.Empty); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolderX64.FullName, "test_x64.msix"), string.Empty, TestContext.CancellationTokenSource.Token); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolderArm64.FullName, "test_arm64.msix"), string.Empty, TestContext.CancellationTokenSource.Token); AddDefaultFakeSuccessfulSubmission(); @@ -99,8 +101,8 @@ public async Task PublishCommandForMauiAppsShouldCallMSBuildIfWindows() var appPackagesFolderX64 = Directory.CreateDirectory(Path.Combine(path, "AppPackages", "x64")); var appPackagesFolderArm64 = Directory.CreateDirectory(Path.Combine(path, "AppPackages", "arm64")); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolderX64.FullName, "test_x64.msix"), string.Empty); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolderArm64.FullName, "test_arm64.msix"), string.Empty); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolderX64.FullName, "test_x64.msix"), string.Empty, TestContext.CancellationTokenSource.Token); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolderArm64.FullName, "test_arm64.msix"), string.Empty, TestContext.CancellationTokenSource.Token); AddDefaultFakeSuccessfulSubmission(); @@ -132,7 +134,7 @@ await FlutterProjectConfigurator.UpdateManifestAsync( null, CancellationToken.None); var appPackagesFolder = Directory.CreateDirectory(Path.Combine(path, "build", "windows", "x64", "runner", "Release")); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.msix"), string.Empty); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.msix"), string.Empty, TestContext.CancellationTokenSource.Token); AddDefaultFakeSuccessfulSubmission(); @@ -162,7 +164,7 @@ await ElectronProjectConfigurator.UpdateManifestAsync( ElectronManifestManager.Object, CancellationToken.None); var appPackagesFolder = Directory.CreateDirectory(Path.Combine(path, "dist")); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.appx"), string.Empty); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.appx"), string.Empty, TestContext.CancellationTokenSource.Token); AddDefaultFakeSuccessfulSubmission(); @@ -200,7 +202,7 @@ public async Task PublishCommandForReactNativeAppsShouldUploadAppxUpload(string AppXManifestManager.Object.UpdateManifest(appxManifest.FullName, FakeApps[0], "publisher", null); var appPackagesFolder = Directory.CreateDirectory(Path.Combine(appxManifest.Directory!.FullName, "AppPackages")); - await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.appxupload"), string.Empty); + await File.WriteAllTextAsync(Path.Combine(appPackagesFolder.FullName, "test.appxupload"), string.Empty, TestContext.CancellationTokenSource.Token); AddDefaultFakeSuccessfulSubmission(); diff --git a/MSStore.CLI.UnitTests/TelemetryUnitTests.cs b/MSStore.CLI.UnitTests/TelemetryUnitTests.cs index 0dac7b9..2b0b5d7 100644 --- a/MSStore.CLI.UnitTests/TelemetryUnitTests.cs +++ b/MSStore.CLI.UnitTests/TelemetryUnitTests.cs @@ -8,10 +8,12 @@ namespace MSStore.CLI.UnitTests [TestClass] public class TelemetryUnitTests : BaseCommandLineTest { + public TestContext TestContext { get; set; } + [TestMethod] public async Task TelemetryConfigurationLoadsAsync() { - var telemetryConnectionStringProvider = await TelemetryConnectionStringProvider.LoadAsync(default); + var telemetryConnectionStringProvider = await TelemetryConnectionStringProvider.LoadAsync(default, TestContext.CancellationTokenSource.Token); telemetryConnectionStringProvider.Should().NotBeNull(); diff --git a/MSStore.CLI/MSStore.CLI.csproj b/MSStore.CLI/MSStore.CLI.csproj index 88f0da9..6d9934e 100644 --- a/MSStore.CLI/MSStore.CLI.csproj +++ b/MSStore.CLI/MSStore.CLI.csproj @@ -31,15 +31,15 @@ - + - - - - - - - + + + + + + +