This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 95
/
azure-pipelines.yml
159 lines (137 loc) · 5.26 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
sdl:
sourceAnalysisPool:
name: AzurePipelines-EO
image: AzurePipelinesWindows2022compliantGPT
os: windows
sbom:
enabled: false
stages:
- stage: Build
jobs:
- job: Default
timeoutInMinutes: 360
pool:
name: 'Azure Pipelines'
vmImage: 'macos-latest'
os: macOS
variables:
- name: BuildConfiguration
value: Debug
- name: TeamName
value: Mono.Addins
- name: Codeql.Enabled
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
- name: Codeql.TSAEnabled
value: true
- name: Codeql.SkipTaskAutoInjection # Auto injection is disabled for now, since it causes the sign process to hang.
value: true # Instead, CodeQL tasks are explicitly inserted. The finalize task is inserted before the signing task to avoid the hang.
- name: BUILDSECMON_OPT_IN
value: true
- name: Packaging.EnableSBOMSigning
value: true
- name: System.Debug
value: true
steps:
- task: CodeQL3000Init@0
# Python 3 is needed for the MicroBuild Signing Plugin
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- task: MicroBuildSigningPlugin@4
displayName: 'Install Signing Plugin'
inputs:
signType: 'Real'
azureSubscription: 'MicroBuild Signing Task (DevDiv)'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
- task: UseDotNet@2
displayName: 'Install .NET 3.1'
inputs:
packageType: 'sdk'
version: '3.1.413'
- task: UseDotNet@2
displayName: 'Install .NET 6'
inputs:
packageType: 'sdk'
version: '6.0.100'
- task: DotNetCoreCLI@2
displayName: 'Build solution Mono.Addins.sln'
inputs:
command: build
arguments: '/p:Configuration=$(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Generate packages'
inputs:
command: custom
custom: pack
projects: Mono.Addins.sln
arguments: '/p:Configuration=$(BuildConfiguration)'
nobuild: true
workingDirectory: $(Build.SourcesDirectory)
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: 'test'
workingDirectory: '$(Build.SourcesDirectory)/Test/UnitTests'
- task: CodeQL3000Finalize@0
- task: Bash@3
displayName: 'Generate package file list'
inputs:
targetType: 'inline'
script: |
echo "<filelist>" > $(build.sourcesdirectory)/bin/files.xml
echo " <certificate certnumbers='401405'>" >> $(build.sourcesdirectory)/bin/files.xml
find $(build.sourcesdirectory)/bin -name "*.nupkg" -exec echo " <file srcpath='{}' dstpath='{}'></file>" \; >> $(build.sourcesdirectory)/bin/files.xml
echo " </certificate>" >> $(build.sourcesdirectory)/bin/files.xml
echo "</filelist>" >> $(build.sourcesdirectory)/bin/files.xml
workingDirectory: '$(build.sourcesdirectory)/bin'
- task: Bash@3
displayName: 'Sign Packages'
inputs:
targetType: 'inline'
script: |
dotnet $(MBSIGN_APPFOLDER)/ddsignfiles.dll /filelist:$(build.sourcesdirectory)/bin/files.xml
workingDirectory: '$(build.sourcesdirectory)/bin'
- task: CopyFiles@1
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)/bin'
Contents: '*.nupkg'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: 1ES.PublishPipelineArtifact@1
displayName: 'Publish Artifact: drop'
inputs:
targetPath: '$(build.artifactstagingdirectory)'
artifactName: drop
condition: succeededOrFailed()
# Use separate directory when generating SBOM to avoid MicroBuild files being included
- task: Bash@3
displayName: 'Copy files for SBOM'
inputs:
targetType: 'inline'
script: |
mkdir sbom
cp *.nupkg sbom
workingDirectory: '$(build.artifactstagingdirectory)'
- task: ManifestGeneratorTask@0
inputs:
PackageName: 'Mono.Addins'
BuildDropPath: '$(build.artifactstagingdirectory)/sbom'
ManifestDirPath: '$(build.sourcesdirectory)'
AdditionalComponentDetectorArgs: '--DirectoryExclusionList **/Test/**;**/Samples/**;**/mautil/**'
displayName: 'Generating SBOM'
- task: 1ES.PublishPipelineArtifact@1
inputs:
targetPath: '$(build.sourcesdirectory)/_manifest'
artifactName: SBOM
displayName: Publish SBOM