Skip to content

Commit

Permalink
[ci] Add ApiScan. (#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpobst authored Dec 15, 2023
1 parent b692c95 commit 4171f72
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
37 changes: 37 additions & 0 deletions build/ci/api-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
parameters:
apiScanDirectory: $(Agent.TempDirectory)\APIScanFiles # The directory to copy and scan assemblies
mainBranchName: # The "main" branch that should be used - can be something other than "main"

steps:

### Copy .dll and .pdb files for APIScan
- task: CopyFiles@2
displayName: 'Collect Files for APIScan'
inputs:
Contents: |
generated\**\bin\Release\**\?(*.dll|*.pdb)
util\**\bin\Release\**\?(*.dll|*.pdb)
TargetFolder: ${{ parameters.apiScanDirectory }}
OverWrite: true
flattenFolders: true
condition: and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))

- task: CmdLine@2
displayName: 'List Files for APIScan'
inputs:
script: |
tree ${{ parameters.apiScanDirectory }} /f
condition: and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))

### Run latest version of APIScan listed at https://www.1eswiki.com/wiki/APIScan_Build_Task
- task: APIScan@2
displayName: Run APIScan
inputs:
softwareFolder: ${{ parameters.apiScanDirectory }}
softwareName: $(ApiScanName)
softwareVersionNum: '$(Build.BuildId)'
isLargeApp: true
toolVersion: Latest
condition: and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
env:
AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret)
5 changes: 5 additions & 0 deletions build/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
imageName: ${{ parameters.windowsImage }}
classicInstallerUrl: ${{ parameters.classicXAVsix }}
runCodeQL: true
runAPIScan: true
displayName: Build
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
variables:
Expand All @@ -73,6 +74,10 @@ jobs:
configuration: ${{ parameters.configuration }}
skipUnitTests: ${{ parameters.skipUnitTests }}

- template: api-scan.yml
parameters:
mainBranchName: ${{ parameters.mainBranchName }}

# after the build is complete
- pwsh: |
$srcExists = (Test-Path "${{ parameters.signListPath }}")
Expand Down

0 comments on commit 4171f72

Please sign in to comment.