From e2bf1ceee715d4c2a4ee08e2079a8f0f9b17159b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 19 Mar 2024 12:09:32 -0600 Subject: [PATCH 01/19] Update PublishCodeCoverageResults task to v2 --- azure-pipelines/publish-codecoverage.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index fbb6a39..8ec94e6 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -17,9 +17,8 @@ steps: condition: and(succeeded(), ${{ parameters.includeMacOS }}) - powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputFile coveragereport/merged.cobertura.xml -Format Cobertura -Verbose displayName: ⚙ Merge coverage -- task: PublishCodeCoverageResults@1 +- task: PublishCodeCoverageResults@2 displayName: 📢 Publish code coverage results to Azure DevOps inputs: - codeCoverageTool: cobertura summaryFileLocation: coveragereport/merged.cobertura.xml failIfCoverageEmpty: true From e69fef21e7bb686d2175c1f24995e7514a9ea21c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2024 15:13:27 -0600 Subject: [PATCH 02/19] Bump several dependencies --- Directory.Packages.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1efd3c0..fe766e3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,11 +7,11 @@ - - + + - + From ebd7dc1ea948f79a9af8a1de98c2971aee885637 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2024 15:17:04 -0600 Subject: [PATCH 03/19] Bump MicroBuild to 2.0.162 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a139a39..2cafae6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true true - 2.0.152 + 2.0.162 From baf10f7ffd53dee5b61099c371022a15bd6070b5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 10 Jul 2024 10:15:20 -0700 Subject: [PATCH 04/19] Fix github actions warnings --- .github/workflows/build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3350282..06d884d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: ⚙ Install prerequisites @@ -56,53 +56,53 @@ jobs: if: always() - name: 📢 Upload project.assets.json files if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: projectAssetsJson-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/projectAssetsJson continue-on-error: true - name: 📢 Upload variables - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: variables-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/Variables continue-on-error: true - name: 📢 Upload build_logs if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: build_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/build_logs continue-on-error: true - name: 📢 Upload test_logs if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: test_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/test_logs continue-on-error: true - name: 📢 Upload testResults if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: testResults-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/testResults continue-on-error: true - name: 📢 Upload coverageResults if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: coverageResults-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/coverageResults continue-on-error: true - name: 📢 Upload symbols - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: symbols-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/symbols continue-on-error: true - name: 📢 Upload deployables - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: deployables-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/deployables From f93bdce9c96216e096c5a02927c3176cd9b5699b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 10 Jul 2024 10:19:19 -0700 Subject: [PATCH 05/19] Skip codecov publishing without token --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06d884d..cdf4ac9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,4 +112,4 @@ jobs: shell: pwsh timeout-minutes: 3 continue-on-error: true - if: always() + if: env.codecov_token != '' From 03d69cfcbb867ac82907ed10b52fddbf71398ec3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2024 17:53:47 -0600 Subject: [PATCH 06/19] Sign the `*.VSInsertionMetadata` optprof package --- Expand-Template.ps1 | 8 +-- .../InsertionMetadataPackage.nuspec | 17 ----- azure-pipelines/artifacts/VSInsertion.ps1 | 25 +------- azure-pipelines/dotnet.yml | 5 +- global.json | 3 + .../Library.VSInsertionMetadata.proj | 11 ++++ .../ProfilingInputs.props | 0 .../VSInsertionMetadata.targets | 64 +++++++++++++++++++ 8 files changed, 83 insertions(+), 50 deletions(-) delete mode 100644 azure-pipelines/InsertionMetadataPackage.nuspec create mode 100644 src/VSInsertionMetadata/Library.VSInsertionMetadata.proj rename {azure-pipelines => src/VSInsertionMetadata}/ProfilingInputs.props (100%) create mode 100644 src/VSInsertionMetadata/VSInsertionMetadata.targets diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 9cbdee9..f91ab76 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -105,6 +105,8 @@ try { if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git mv test/Library.Tests "test/$LibraryName.Tests" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + git mv src/VSInsertionMetadata/Library.VSInsertionMetadata.proj "src/VSInsertionMetadata/$LibraryName.VSInsertionMetadata.proj" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Refresh solution file both to update paths and give the projects unique GUIDs dotnet sln remove src/Library/Library.csproj @@ -168,12 +170,6 @@ try { 'LibraryName' = $LibraryName; } - Replace-Placeholders -Path "azure-pipelines/InsertionMetadataPackage.nuspec" -Replacements @{ - 'LibraryName' = $LibraryName; - } - Replace-Placeholders -Path "azure-pipelines/artifacts/VSInsertion.ps1" -Replacements @{ - 'LibraryName' = $LibraryName; - } Replace-Placeholders -Path "azure-pipelines/OptProf.yml" -Replacements @{ 'LibraryName' = $LibraryName; } diff --git a/azure-pipelines/InsertionMetadataPackage.nuspec b/azure-pipelines/InsertionMetadataPackage.nuspec deleted file mode 100644 index aae33f5..0000000 --- a/azure-pipelines/InsertionMetadataPackage.nuspec +++ /dev/null @@ -1,17 +0,0 @@ - - - - - LibraryName.VSInsertionMetadata - $version$ - Microsoft - Microsoft - - false - Contains metadata for insertion into VS. - © Microsoft Corporation. All rights reserved. - - - - - diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 4c528f5..de7899e 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -29,30 +29,7 @@ $result = @{ if ($env:IsOptProf) { $VSRepoPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/VSRepo" - - $ArtifactBasePath = "$RepoRoot\obj\_artifacts" - $ArtifactPath = "$ArtifactBasePath\VSInsertion" - if (-not (Test-Path $ArtifactPath)) { New-Item -ItemType Directory -Path $ArtifactPath | Out-Null } - - $profilingInputs = [xml](Get-Content -Path "$PSScriptRoot\..\ProfilingInputs.props") - $profilingInputs.Project.ItemGroup.TestStore.Include = "vstsdrop:" + (& "$PSScriptRoot\..\variables\ProfilingInputsDropName.ps1") - $profilingInputs.Save("$ArtifactPath\ProfilingInputs.props") - - $InsertionMetadataVersion = $(dotnet tool run nbgv get-version -p "$RepoRoot\src" -f json | ConvertFrom-Json).NuGetPackageVersion - if ($env:BUILD_BUILDID) { - # We must ensure unique versions for the insertion metadata package so - # it can contain information that is unique to this build. - # In particular it includes the ProfilingInputsDropName, which contains the BuildId. - # A non-unique package version here may collide with a prior run of this same commit, - # ultimately resulting in a failure of the optprof run. - $InsertionMetadataVersion += '.' + $env:BUILD_BUILDID - } - & (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $VSRepoPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null - if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE - } - - $result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\LibraryName.VSInsertionMetadata.$InsertionMetadataVersion.nupkg"); + $result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\*.VSInsertionMetadata.*.nupkg"); } $result diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 828bd7b..196fd4b 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -17,9 +17,8 @@ steps: condition: and(succeeded(), ${{ parameters.RunTests }}) - ${{ if parameters.IsOptProf }}: - # We have to artifically run this script so that the extra .nupkg is produced for variables/InsertPropsValues.ps1 to notice. - - powershell: azure-pipelines\artifacts\VSInsertion.ps1 - displayName: 🔧 Prepare VSInsertion artifact + - script: dotnet pack src\VSInsertionMetadata -c $(BuildConfiguration) -warnaserror /bl:"$(Build.ArtifactStagingDirectory)/build_logs/VSInsertion-Pack.binlog" + displayName: 🔧 dotnet pack VSInsertionMetadata - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true diff --git a/global.json b/global.json index c83e939..e32504c 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "8.0.300", "rollForward": "patch", "allowPrerelease": false + }, + "msbuild-sdks": { + "Microsoft.Build.NoTargets": "3.7.56" } } diff --git a/src/VSInsertionMetadata/Library.VSInsertionMetadata.proj b/src/VSInsertionMetadata/Library.VSInsertionMetadata.proj new file mode 100644 index 0000000..0caaedb --- /dev/null +++ b/src/VSInsertionMetadata/Library.VSInsertionMetadata.proj @@ -0,0 +1,11 @@ + + + netstandard2.0 + true + $(RepoRootPath)bin\Packages\$(Configuration)\VSRepo\ + false + false + Contains metadata for insertion into VS. + + + diff --git a/azure-pipelines/ProfilingInputs.props b/src/VSInsertionMetadata/ProfilingInputs.props similarity index 100% rename from azure-pipelines/ProfilingInputs.props rename to src/VSInsertionMetadata/ProfilingInputs.props diff --git a/src/VSInsertionMetadata/VSInsertionMetadata.targets b/src/VSInsertionMetadata/VSInsertionMetadata.targets new file mode 100644 index 0000000..b73e09a --- /dev/null +++ b/src/VSInsertionMetadata/VSInsertionMetadata.targets @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + $(TargetsForTfmSpecificContentInPackage); + SubstituteProfilingInputsMacro; + SubstituteProfilingInputsMacroWarning; + + + + + + + + + + + + + + + + + + + + $(PackageVersion).$(Build_BuildId) + + + From 0c9771db3042989a06645b5c8f1af9c1d155b32a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2024 10:20:19 -0600 Subject: [PATCH 07/19] Break until the insertion project is renamed --- .../VSInsertionMetadata.targets | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/VSInsertionMetadata/VSInsertionMetadata.targets b/src/VSInsertionMetadata/VSInsertionMetadata.targets index b73e09a..9b23536 100644 --- a/src/VSInsertionMetadata/VSInsertionMetadata.targets +++ b/src/VSInsertionMetadata/VSInsertionMetadata.targets @@ -25,14 +25,10 @@ $(TargetsForTfmSpecificContentInPackage); SubstituteProfilingInputsMacro; - SubstituteProfilingInputsMacroWarning; - - - - + @@ -43,13 +39,20 @@ OutputFilename="@(ProfilingInputsTarget)" MatchExpression="%TESTSTORE%" ReplacementText="vstsdrop:$(ProfilingInputsDropName)" /> + + + + + Condition="'$(Build_BuildId)' != ''" + AfterTargets="GetBuildVersion">