From 6dccf9ef884a6b1613f14682d8ae181563a00559 Mon Sep 17 00:00:00 2001 From: Dan Legg Date: Thu, 28 Mar 2024 18:06:25 -0700 Subject: [PATCH] Pipeline changes to build, publish, and test (#1400) Co-authored-by: Dan Legg --- .pipelines/OneBranch.Official.yml | 4 ---- .pipelines/jobs/OneBranchNuGet.yml | 15 ++++++++------- .pipelines/jobs/OneBranchTest.yml | 3 +++ .pipelines/jobs/OneBranchVsix.yml | 4 ++-- test/test_cpp20/format.cpp | 9 +++++++++ 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index def1114a..3c2ffdfc 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -34,10 +34,6 @@ extends: globalSdl: tsa: enabled: false - - nugetPublishing: - feeds: - name: CppWinRT stages: - stage: build diff --git a/.pipelines/jobs/OneBranchNuGet.yml b/.pipelines/jobs/OneBranchNuGet.yml index 803e6f9f..e2a87111 100644 --- a/.pipelines/jobs/OneBranchNuGet.yml +++ b/.pipelines/jobs/OneBranchNuGet.yml @@ -15,7 +15,6 @@ jobs: variables: ob_outputDirectory: '$(Build.SourcesDirectory)\out' - ob_nugetPublishing_enabled: ${{ parameters.OfficialBuild }} PackageVersion: ${{ parameters.BuildVersion }} steps: @@ -59,12 +58,8 @@ jobs: - task: NuGetCommand@2 displayName: 'Build NuGet package' inputs: - command: 'pack' - packagesToPack: 'nuget/Microsoft.Windows.CppWinRT.nuspec' - versioningScheme: byEnvVar - versionEnvVar: 'PackageVersion' - buildProperties: 'cppwinrt_exe=$(Build.SourcesDirectory)\x86\cppwinrt\cppwinrt.exe;cppwinrt_fast_fwd_x86=$(Build.SourcesDirectory)\x86\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=$(Build.SourcesDirectory)\x64\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm=$(Build.SourcesDirectory)\arm\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=$(Build.SourcesDirectory)\arm64\cppwinrt_fast_forwarder.lib' - packDestination: $(ob_outputDirectory)\packages + command: 'custom' + arguments: 'pack nuget/Microsoft.Windows.CppWinRT.nuspec -NonInteractive -OutputDirectory $(ob_outputDirectory)\packages -Properties Configuration=release;cppwinrt_exe=$(Build.SourcesDirectory)\x86\cppwinrt\cppwinrt.exe;cppwinrt_fast_fwd_x86=$(Build.SourcesDirectory)\x86\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=$(Build.SourcesDirectory)\x64\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm=$(Build.SourcesDirectory)\arm\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=$(Build.SourcesDirectory)\arm64\cppwinrt_fast_forwarder.lib;target_version=$(PackageVersion) -Version $(PackageVersion) -Verbosity Detailed' - task: onebranch.pipeline.signing@1 displayName: '🔒 Onebranch Signing for NuGet package' @@ -74,3 +69,9 @@ jobs: signing_profile: external_distribution files_to_sign: 'Microsoft.Windows.CppWinRT.*.nupkg' search_root: $(ob_outputDirectory)\packages + + - task: NuGetCommand@2 + displayName: 'Publish NuGet package' + inputs: + command: 'custom' + arguments: 'push $(ob_outputDirectory)\packages\Microsoft.Windows.CppWinRT.$(PackageVersion).nupkg -NonInteractive -Source https://microsoft.pkgs.visualstudio.com/_packaging/CppWinRT/nuget/v3/index.json -ApiKey VSTS' \ No newline at end of file diff --git a/.pipelines/jobs/OneBranchTest.yml b/.pipelines/jobs/OneBranchTest.yml index d9634ff1..bba8dac2 100644 --- a/.pipelines/jobs/OneBranchTest.yml +++ b/.pipelines/jobs/OneBranchTest.yml @@ -8,6 +8,9 @@ jobs: - job: pool: type: windows + isCustom: true + name: 'Azure Pipelines' + vmImage: 'windows-2022' # (or 2019) strategy: matrix: test.x86: diff --git a/.pipelines/jobs/OneBranchVsix.yml b/.pipelines/jobs/OneBranchVsix.yml index 2efa5b29..3526712e 100644 --- a/.pipelines/jobs/OneBranchVsix.yml +++ b/.pipelines/jobs/OneBranchVsix.yml @@ -108,8 +108,8 @@ jobs: inputs: command: sign signing_profile: external_distribution - files_to_sign: '**/Microsoft.Windows.CppWinRT.*.dll' - search_root: '$(Agent.TempDirectory)\$(VsixFilename)' + files_to_sign: '**\*.dll' + search_root: '$(Agent.TempDirectory)' - task: ArchiveFiles@2 displayName: 'Repack signed VSIX contents' diff --git a/test/test_cpp20/format.cpp b/test/test_cpp20/format.cpp index 0c40a411..d1619332 100644 --- a/test/test_cpp20/format.cpp +++ b/test/test_cpp20/format.cpp @@ -17,17 +17,26 @@ TEST_CASE("format") winrt::hstring str = L"World"; REQUIRE(std::format(L"Hello {}", str) == L"Hello World"); } +} +TEST_CASE("format_make") +{ { winrt::Windows::Foundation::IStringable obj = winrt::make(); REQUIRE(std::format(L"This is {}", obj) == L"This is a stringable object"); } +} +TEST_CASE("format_json") +{ { winrt::Windows::Data::Json::JsonArray jsonArray; REQUIRE(std::format(L"The contents of the array are: {}", jsonArray) == L"The contents of the array are: []"); } +} +TEST_CASE("format_wstring") +{ #if __cpp_lib_format >= 202207L { std::wstring str = L"World";