diff --git a/ApiCompatBaseline.txt b/ApiCompatBaseline.txt new file mode 100644 index 000000000..23f3c83d9 --- /dev/null +++ b/ApiCompatBaseline.txt @@ -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. \ No newline at end of file diff --git a/src/build/yaml/ci-api-validation-steps.yml b/src/build/yaml/ci-api-validation-steps.yml index 5123dacf6..892133d15 100644 --- a/src/build/yaml/ci-api-validation-steps.yml +++ b/src/build/yaml/ci-api-validation-steps.yml @@ -5,30 +5,37 @@ parameters: steps: - task: DownloadPipelineArtifact@2 - displayName: 'Download $(PackageName).dll from Artifacts' + displayName: 'Download OutputDlls from Artifacts' inputs: artifactName: 'OutputDlls-$(BuildConfiguration)' - patterns: '$(PackageName).dll' - targetPath: '$(System.ArtifactsDirectory)/Artifacts' + targetPath: '$(System.ArtifactsDirectory)/OutputDlls' -- task: NuGetCommand@2 - displayName: 'NuGet install $(PackageName) v ${{ parameters.ContractVersion }}' +- task: DownloadPipelineArtifact@2 + displayName: 'Download ContractDlls from Artifacts' inputs: - command: custom - arguments: 'install $(PackageName) -Version ${{ parameters.ContractVersion }} -OutputDirectory $(System.DefaultWorkingDirectory)\DownloadedNuGet' + artifactName: 'ContractDlls' + 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 displayName: 'Compare binaries' inputs: - contractsRootFolder: 'DownloadedNuGet\$(PackageName).${{ parameters.ContractVersion }}\lib\netstandard2.0' + contractsRootFolder: '$(System.ArtifactsDirectory)/ContractDlls' contractsFileName: '$(PackageName).dll' - implFolder: '$(System.ArtifactsDirectory)/Artifacts' + implFolder: '$(System.ArtifactsDirectory)/OutputDlls' failOnIssue: false resolveFx: false generateLog: true outputFilename: '$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt' outputFolder: '$(Build.ArtifactStagingDirectory)' - useBaseline: false + useBaseline: true + baselineFile: ApiCompatBaseline.txt + continueOnError: true - powershell: | $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." New-Item -Path '$(Build.ArtifactStagingDirectory)' -Name '$(PackageName).${{ parameters.ContractVersion }}.CompatResults.txt' -ItemType "file" -Value $content $content; + Write-Host "##vso[task.complete result=Failed;]"; return; } diff --git a/src/build/yaml/feed-setup-step.yml b/src/build/yaml/feed-setup-step.yml index 6713412d3..2d893694d 100644 --- a/src/build/yaml/feed-setup-step.yml +++ b/src/build/yaml/feed-setup-step.yml @@ -52,4 +52,4 @@ steps: New-Item -Path $file -ItemType "file" -Value $content -Force; '-------------'; get-content "$file"; '==================='; - displayName: Create nuget.config for SDK feed \ No newline at end of file + displayName: SDK feed setup \ No newline at end of file diff --git a/src/build/yaml/powerfx-ci.yml b/src/build/yaml/powerfx-ci.yml index 0b345b298..a5ae82f64 100644 --- a/src/build/yaml/powerfx-ci.yml +++ b/src/build/yaml/powerfx-ci.yml @@ -157,6 +157,47 @@ stages: condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], '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: | $multiconfig = '{'; $env:PackagesToValidate.Split(",") | ForEach { @@ -184,7 +225,7 @@ stages: contractVersion: $[ dependencies.generate_multiconfig_var.outputs['GetContract.ContractVersion'] ] steps: - - checkout: none + - checkout: self - template: feed-setup-step.yml parameters: