Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish api json file and enable api change detection #17837

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions eng/pipelines/templates/steps/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ steps:
node eng/tools/rush-runner.js unlink
displayName: "Unlink dependencies"

- template: /eng/common/pipelines/templates/steps/create-apireview.yml
parameters:
Artifacts: ${{ parameters.Artifacts }}
ArtifactPath: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}

- template: ../steps/generate-doc.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
Expand All @@ -86,6 +81,7 @@ steps:
New-Item -Type Directory -Name $artifactName -Path $(Build.ArtifactStagingDirectory) > $null
Copy-Item sdk/${{parameters.ServiceDirectory}}/**/$artifactName-[0-9]*.[0-9]*.[0-9]*.tgz $(Build.ArtifactStagingDirectory)/$artifactName
Copy-Item sdk/${{parameters.ServiceDirectory}}/**/browser/$artifactName-[0-9]*.[0-9]*.[0-9]*.zip $(Build.ArtifactStagingDirectory)/$artifactName
Copy-Item sdk/${{parameters.ServiceDirectory}}/**/temp/*.api.json $(Build.ArtifactStagingDirectory)/$artifactName
if ($${{ parameters.IncludeRelease }} -eq $true)
{
New-Item -Type Directory -Name documentation -Path $(Build.ArtifactStagingDirectory)/$artifactName > $null
Expand All @@ -98,3 +94,11 @@ steps:
parameters:
ArtifactPath: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'packages'

- template: /eng/common/pipelines/templates/steps/create-apireview.yml
parameters:
Artifacts: ${{ parameters.Artifacts }}

- template: /eng/common/pipelines/templates/steps/detect-api-changes.yml
parameters:
Artifacts: ${{ parameters.Artifacts }}
20 changes: 8 additions & 12 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -404,25 +404,22 @@ Removed $($package.name) because of docs package validation failure on $(Get-Dat
}

# function is used to auto generate API View
function Find-javascript-Artifacts-For-Apireview($artifactDir, $packageName = "")
function Find-javascript-Artifacts-For-Apireview($artifactDir, $packageName)
{
# Find api.json file in service temp directory
[regex]$pattern = "azure-"
$pkgName = $pattern.replace($packageName, "", 1)
$packageDir = Join-Path $artifactDir $pkgName "temp"
if (Test-Path $packageDir)
$artifactPath = Join-Path $artifactDir $packageName
if (Test-Path $artifactPath)
{
Write-Host "Searching for *.api.json in path $($packageDir)"
$files = Get-ChildItem "${packageDir}" | Where-Object -FilterScript { $_.Name.EndsWith(".api.json") }
Write-Host "Searching for *.api.json in path $($artifactPath)"
$files = Get-ChildItem "${artifactPath}" | Where-Object -FilterScript { $_.Name.EndsWith(".api.json") }
if (!$files)
{
Write-Host "$($packageDir) does not have api review json for package"
Write-Host "$($artifactPath) does not have api review json for package"
Write-Host "API Extractor must be enabled for $($packageName). Please ensure api-extractor.json is present in package directory and api extract script included in build script"
return $null
}
elseif ($files.Count -ne 1)
{
Write-Host "$($packageDir) should contain only one api review for $($packageName)"
Write-Host "$($artifactPath) should contain only one api review for $($packageName)"
Write-Host "No of Packages $($files.Count)"
return $null
}
Expand All @@ -431,8 +428,7 @@ function Find-javascript-Artifacts-For-Apireview($artifactDir, $packageName = ""
{
Write-Host "$($pkgName) does not have api review json"
return $null
}

}
$packages = @{
$files[0].Name = $files[0].FullName
}
Expand Down