diff --git a/eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml b/eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml index b2d5d92c1a4..3f214e82052 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml @@ -39,6 +39,9 @@ parameters: - name: StandaloneExeMatrix type: object default: [] + - name: ReleaseBinaries + type: boolean + default: false variables: - template: ../variables/globals.yml @@ -66,7 +69,7 @@ stages: inputs: version: '${{ coalesce( parameters.DotNetCoreVersion, variables.DotNetCoreVersion) }}' - - script: 'dotnet pack /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) $(Warn) -c Release' + - script: 'dotnet pack /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory)/packages $(Warn) -c Release' displayName: 'Build and Package' workingDirectory: '${{ coalesce(parameters.PackageDirectory, parameters.ToolDirectory) }}' env: @@ -80,11 +83,17 @@ stages: BuildMatrix: ${{ parameters.StandaloneExeMatrix }} TargetDirectory: '${{ coalesce(parameters.PackageDirectory, parameters.ToolDirectory) }}' - - publish: $(Build.ArtifactStagingDirectory) - displayName: Publish package to run artifacts + - publish: $(Build.ArtifactStagingDirectory)/packages + displayName: Publish to packages artifact artifact: packages condition: succeededOrFailed() + - ${{ if gt(length(parameters.StandaloneExeMatrix), 0) }}: + - publish: $(Build.ArtifactStagingDirectory)/binaries + displayName: Publish executables to binaries artifact + artifact: binaries + condition: succeededOrFailed() + - job: Test steps: @@ -124,6 +133,8 @@ stages: parameters: # Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-net DevOpsFeedId: '29ec6040-b234-4e31-b139-33dc4287b756/fa8c16a3-dbe0-4de2-a297-03065ec1ba3f' + ExeMatrix: ${{ parameters.StandaloneExeMatrix }} + ShouldPublishExecutables: ${{ parameters.ReleaseBinaries }} - ${{if and(not(eq(length(parameters.DockerDeployments), 0)), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: - stage: PublishDockerImages diff --git a/eng/pipelines/templates/steps/produce-net-standalone-packs.yml b/eng/pipelines/templates/steps/produce-net-standalone-packs.yml index e9df3b85dee..e743a9de5a1 100644 --- a/eng/pipelines/templates/steps/produce-net-standalone-packs.yml +++ b/eng/pipelines/templates/steps/produce-net-standalone-packs.yml @@ -17,25 +17,29 @@ parameters: # framework: net6.0 steps: + - pwsh: | + mkdir -p "$(Build.ArtifactStagingDirectory)/binaries" + displayName: Create destination directory + - ${{ each target in parameters.BuildMatrix }}: - pwsh: | - $destinationPathSegment = "$(Build.ArtifactStagingDirectory)/$((Split-Path -Leaf "${{ parameters.TargetDirectory }}"))-standalone-${{ target.rid }}" + $destinationPathSegment = "$(Build.ArtifactStagingDirectory)/binaries/$((Split-Path -Leaf "${{ parameters.TargetDirectory }}"))-standalone-${{ target.rid }}" $sourcePath = "${{ parameters.TargetDirectory }}/${{ target.rid }}" - Write-Host "dotnet publish -f ${{ target.framework }} -c Release -r ${{ target.rid }} --self-contained --output ${{ parameters.TargetDirectory }}/${{ target.rid }}" - dotnet publish -f ${{ target.framework }} -c Release -r ${{ target.rid }} --self-contained --output ${{ parameters.TargetDirectory }}/${{ target.rid }} + Write-Host "dotnet publish -f ${{ target.framework }} -c Release -r ${{ target.rid }} --self-contained -p:PublishSingleFile=true --output ${{ parameters.TargetDirectory }}/${{ target.rid }}" + dotnet publish -f ${{ target.framework }} -c Release -r ${{ target.rid }} --self-contained -p:PublishSingleFile=true --output ${{ parameters.TargetDirectory }}/${{ target.rid }} if ($LASTEXITCODE -ne 0) { Write-Error "dotnet publish failed with exit code $LASTEXITCODE." exit $LASTEXITCODE } - # windows? produce a zip, otherwise tar.gz - if ("${{ target.rid }}".StartsWith("win")){ - Compress-Archive -Path "$($sourcePath)/*" -DestinationPath "$($destinationPathSegment).zip" + # produce a tar.gz only for linux + if ("${{ target.rid }}".Contains("linux")){ + tar -cvzf "$($destinationPathSegment).tar.gz" "$sourcePath" } else { - tar -cvzf "$($destinationPathSegment).tar.gz" "$sourcePath" + Compress-Archive -Path "$($sourcePath)/*" -DestinationPath "$($destinationPathSegment).zip" } # clean up the uncompressed artifact directory diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj index dc55d751a4c..9ab73a30465 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/Azure.Sdk.Tools.TestProxy.Tests.csproj @@ -3,6 +3,7 @@ net6.0 false + false diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Azure.Sdk.Tools.TestProxy.csproj b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Azure.Sdk.Tools.TestProxy.csproj index 3840ac29445..1fa934582d3 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Azure.Sdk.Tools.TestProxy.csproj +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Azure.Sdk.Tools.TestProxy.csproj @@ -1,6 +1,6 @@ - net6.0;net5.0 + net6.0 $(NoWarn);1591;AZC0001;AZC0012;CA1724;CA1801;CA1812;CA1822;SA1028 true true diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Models/RunTimeMetadataModel.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Models/RunTimeMetadataModel.cs index dd2dff0eb7a..59643ed9358 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Models/RunTimeMetadataModel.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Models/RunTimeMetadataModel.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; using System; using System.Collections.Generic; using System.Linq; @@ -129,8 +129,10 @@ public string GetClassDocComment(Type type, XmlDocument docCommentXml) // for this to work you need to have generatexmldoc activated and the generated comment xml MUST be alongside the assembly public XmlDocument GetDocCommentXML() { - var location = Assembly.Location; - using (var xmlReader = new StreamReader(Path.ChangeExtension(location, ".xml"))) + var location = System.AppContext.BaseDirectory; + + var name = Assembly.GetName().Name; + using (var xmlReader = new StreamReader(Path.Join(location, $"{name}.xml"))) { XmlDocument result = new XmlDocument(); result.Load(xmlReader); diff --git a/tools/test-proxy/ci.yml b/tools/test-proxy/ci.yml index 6fc5683e3fa..ce1f22bddca 100644 --- a/tools/test-proxy/ci.yml +++ b/tools/test-proxy/ci.yml @@ -50,13 +50,15 @@ extends: dockerRepo: 'engsys/test-proxy' stableTags: - 'latest' + ReleaseBinaries: true StandaloneExeMatrix: + - rid: osx-x64 + framework: net6.0 + - rid: osx-arm64 + framework: net6.0 - rid: win-x64 framework: net6.0 - rid: linux-x64 framework: net6.0 - rid: linux-arm64 framework: net6.0 - - rid: osx-x64 - framework: net6.0 - \ No newline at end of file