Skip to content

Commit d3754c8

Browse files
committed
[ci] Add ApiScan.
1 parent 6c2ab2c commit d3754c8

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

build/ci/api-scan.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
parameters:
2+
apiScanDirectory: $(Agent.TempDirectory)\APIScanFiles # The directory to copy and scan assemblies
3+
mainBranchName: # The "main" branch that should be used - can be something other than "main"
4+
5+
steps:
6+
7+
### Copy .dll and .pdb files for APIScan
8+
- task: CopyFiles@2
9+
displayName: 'Collect Files for APIScan'
10+
inputs:
11+
Contents: |
12+
generated\**\bin\Release\**\?(*.dll|*.pdb)
13+
util\**\bin\Release\**\?(*.dll|*.pdb)
14+
TargetFolder: ${{ parameters.apiScanDirectory }}
15+
OverWrite: true
16+
flattenFolders: true
17+
condition: and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
18+
19+
- task: CmdLine@2
20+
displayName: 'List Files for APIScan'
21+
inputs:
22+
script: |
23+
tree ${{ parameters.apiScanDirectory }} /f
24+
condition: and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
25+
26+
### Run latest version of APIScan listed at https://www.1eswiki.com/wiki/APIScan_Build_Task
27+
- task: APIScan@2
28+
displayName: Run APIScan
29+
inputs:
30+
softwareFolder: ${{ parameters.apiScanDirectory }}
31+
softwareName: $(ApiScanName)
32+
softwareVersionNum: '$(Build.BuildId)'
33+
isLargeApp: true
34+
toolVersion: Latest
35+
condition: and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
36+
env:
37+
AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret)

build/ci/build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
# Environment Parameters
33
name: 'build' # the name of the build job for dependency purposes
4-
timeoutInMinutes: 150 # the timeout in minutes
4+
timeoutInMinutes: 180 # the timeout in minutes
55
mainBranchName: 'main' # the "main" branch that should be used - can be something other than "main"
66
macosAgentPoolName: 'Azure Pipelines' # the name of the macOS VM pool
77
macosImage: internal-macos12 # macOS VM image name, must be "internal" locked down image
@@ -48,6 +48,7 @@ jobs:
4848
imageName: ${{ parameters.windowsImage }}
4949
classicInstallerUrl: ${{ parameters.classicXAVsix }}
5050
runCodeQL: true
51+
runAPIScan: true
5152
displayName: Build
5253
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
5354
variables:
@@ -73,6 +74,10 @@ jobs:
7374
configuration: ${{ parameters.configuration }}
7475
skipUnitTests: ${{ parameters.skipUnitTests }}
7576

77+
- template: api-scan.yml
78+
parameters:
79+
mainBranchName: ${{ parameters.mainBranchName }}
80+
7681
# after the build is complete
7782
- pwsh: |
7883
$srcExists = (Test-Path "${{ parameters.signListPath }}")

0 commit comments

Comments
 (0)