API compatibility validation improvements, PowerFx (#707)

- Add file ApiCompatBaseline.txt to compensate for a false compatibility
issue report.
- Download all PowerFx packages together for both the contract and the
implementation. Putting the dependent packages together gets more
accurate API validating. (https://github.com/dotnet/arcade/issues/9725).
- Add task 'Publish compat results to Artifacts'. This makes results
more accessible to forks, as they are not published to forked PRs.
- Tweak var names and display names for readability.
This commit is contained in:
BruceHaley 2022-10-04 16:13:10 -07:00 коммит произвёл GitHub
Родитель cf03abf1b9
Коммит eaf4d9e72d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 63 добавлений и 12 удалений

2
ApiCompatBaseline.txt Normal file
Просмотреть файл

@ -0,0 +1,2 @@
# ApiCompat falsely reports the following issue for Microsoft.PowerFx.Core:
CannotChangeAttribute : Attribute 'Microsoft.AppMagic.Transport.TransportTypeAttribute' on 'Microsoft.PowerFx.Syntax.Span' changed from '[TransportTypeAttribute(0, true, null, null, false)]' in the contract to '[TransportTypeAttribute(TransportKind.ByValue, true, null, null, false)]' in the implementation.

Просмотреть файл

@ -5,30 +5,37 @@ parameters:
steps: steps:
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
displayName: 'Download $(PackageName).dll from Artifacts' displayName: 'Download OutputDlls from Artifacts'
inputs: inputs:
artifactName: 'OutputDlls-$(BuildConfiguration)' artifactName: 'OutputDlls-$(BuildConfiguration)'
patterns: '$(PackageName).dll' targetPath: '$(System.ArtifactsDirectory)/OutputDlls'
targetPath: '$(System.ArtifactsDirectory)/Artifacts'
- task: NuGetCommand@2 - task: DownloadPipelineArtifact@2
displayName: 'NuGet install $(PackageName) v ${{ parameters.ContractVersion }}' displayName: 'Download ContractDlls from Artifacts'
inputs: inputs:
command: custom artifactName: 'ContractDlls'
arguments: 'install $(PackageName) -Version ${{ parameters.ContractVersion }} -OutputDirectory $(System.DefaultWorkingDirectory)\DownloadedNuGet' targetPath: '$(System.ArtifactsDirectory)/ContractDlls'
- powershell: |
Write-Host "The following API compatibility issues are suppressed:";
Get-Content "ApiCompatBaseline.txt";
displayName: 'Show API compat issue suppression list in ApiCompatBaseline.txt'
continueOnError: true
- task: SOUTHWORKS.binaries-comparer.custom-build-release-task.binaries-comparer@0 - task: SOUTHWORKS.binaries-comparer.custom-build-release-task.binaries-comparer@0
displayName: 'Compare binaries' displayName: 'Compare binaries'
inputs: inputs:
contractsRootFolder: 'DownloadedNuGet\$(PackageName).${{ parameters.ContractVersion }}\lib\netstandard2.0' contractsRootFolder: '$(System.ArtifactsDirectory)/ContractDlls'
contractsFileName: '$(PackageName).dll' contractsFileName: '$(PackageName).dll'
implFolder: '$(System.ArtifactsDirectory)/Artifacts' implFolder: '$(System.ArtifactsDirectory)/OutputDlls'
failOnIssue: false failOnIssue: false
resolveFx: false resolveFx: false
generateLog: true generateLog: true
outputFilename: '$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt' outputFilename: '$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt'
outputFolder: '$(Build.ArtifactStagingDirectory)' outputFolder: '$(Build.ArtifactStagingDirectory)'
useBaseline: false useBaseline: true
baselineFile: ApiCompatBaseline.txt
continueOnError: true
- powershell: | - powershell: |
$filePath = "$(Build.ArtifactStagingDirectory)\$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt" $filePath = "$(Build.ArtifactStagingDirectory)\$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt"
@ -39,6 +46,7 @@ steps:
$content = "The binary compatibility report for library '$(PackageName)' wasn't generated. This may have happened because the NuGet library '$(PackageName)' for version '$(ContractVersion)' was unavailable or a connectivity issue." $content = "The binary compatibility report for library '$(PackageName)' wasn't generated. This may have happened because the NuGet library '$(PackageName)' for version '$(ContractVersion)' was unavailable or a connectivity issue."
New-Item -Path '$(Build.ArtifactStagingDirectory)' -Name '$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt' -ItemType "file" -Value $content New-Item -Path '$(Build.ArtifactStagingDirectory)' -Name '$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt' -ItemType "file" -Value $content
$content; $content;
Write-Host "##vso[task.complete result=Failed;]";
return; return;
} }

Просмотреть файл

@ -52,4 +52,4 @@ steps:
New-Item -Path $file -ItemType "file" -Value $content -Force; New-Item -Path $file -ItemType "file" -Value $content -Force;
'-------------'; get-content "$file"; '==================='; '-------------'; get-content "$file"; '===================';
displayName: Create nuget.config for SDK feed displayName: SDK feed setup

Просмотреть файл

@ -157,6 +157,47 @@ stages:
condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True')) condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True'))
continueOnError: true continueOnError: true
- powershell: |
# Set up tokens for private sources
$file = "$(Build.SourcesDirectory)\nuget.config";
$ErrorActionPreference = 'SilentlyContinue';
nuget sources update -ConfigFile "$file" -Name "SDK_Dotnet_V4_org" -username "ContractDlls" -password "$(System.AccessToken)";
nuget sources update -ConfigFile "$file" -Name "PowerFx" -username "ContractDlls" -password "$(System.AccessToken)";
$ErrorActionPreference = 'Continue';
'-------------'; get-content "$file"; '===================';
$PackageNames = "$(PackagesToValidate)";
$ApiContractVersion = "$(GetContract.ContractVersion)";
$TempContractInstallDirectory = ".\TempContractInstallDir";
$OutputDirectory = ".\ContractDlls";
Write-Host "`nDownloading packages version $ApiContractVersion.";
New-Item -ItemType directory -Path $OutputDirectory -Force | Out-Null;
$Names = $PackageNames.Split(',');
foreach ($Name in $Names) {
"---- $Name ------------------";
nuget install $Name -Version $ApiContractVersion -OutputDirectory $TempContractInstallDirectory -DirectDownload -NonInteractive;
if ($LASTEXITCODE -eq 0) {
Copy-Item "$TempContractInstallDirectory\$Name.$ApiContractVersion\lib\netstandard2.0\$Name.dll" $OutputDirectory;
}
else {
Write-Host "##vso[task.complete result=Failed;]";
}
}
displayName: 'Download Contract DLLs to ContractDlls folder'
continueOnError: true
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'ContractDlls'
targetPath: ContractDlls
displayName: 'Push to ContractDlls in Artifacts'
continueOnError: true
- powershell: | - powershell: |
$multiconfig = '{'; $multiconfig = '{';
$env:PackagesToValidate.Split(",") | ForEach { $env:PackagesToValidate.Split(",") | ForEach {
@ -184,7 +225,7 @@ stages:
contractVersion: $[ dependencies.generate_multiconfig_var.outputs['GetContract.ContractVersion'] ] contractVersion: $[ dependencies.generate_multiconfig_var.outputs['GetContract.ContractVersion'] ]
steps: steps:
- checkout: none - checkout: self
- template: feed-setup-step.yml - template: feed-setup-step.yml
parameters: parameters: