-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines.yml
167 lines (145 loc) · 5.37 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
160
161
162
163
164
165
166
167
trigger:
- master
- main
- refs/tags/v*
jobs:
- job: apps
pool:
vmImage: windows-2022
variables:
- group: 'eryph'
- name: buildConfiguration
value: 'Release'
- name: signHash
value: ''
steps:
- task: DotNetCoreCLI@2
displayName: Install AzureSignTool
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
command: 'custom'
custom: 'tool'
arguments: 'install --global azuresigntool'
- task: AzureCLI@2
displayName: download signed ovs package
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
azureSubscription: 'dbosoft Azure PN'
scriptType: 'batch'
scriptLocation: 'inlineScript'
inlineScript: 'az storage blob download --file=$(Build.SourcesDirectory)\ovspackage.zip --container-name=internal --name=ovs/latest/ovspackage_signed.zip --account-name=dbosoftreleaseseuwest'
- task: UseGitVersion@5
inputs:
versionSpec: '5.x'
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
- task: DotNetCoreCLI@2
displayName: dotnet tool restore
inputs:
command: custom
custom: 'tool'
arguments: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: '**/test/**/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage" --no-build --filter "Category!=Docker"'
- task: DotNetCoreCLI@2
displayName: publish zero app
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/apps/**/*-zero/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)\zero_build /p:SignHash=$(signHash)'
zipAfterPublish: false
- task: CmdLine@2
displayName: rename zero build
inputs:
script: 'ren eryph-zero bin'
workingDirectory: '$(Build.ArtifactStagingDirectory)\zero_build'
- task: DotNetCoreCLI@2
displayName: publish uninstaller app
inputs:
command: 'publish'
publishWebProjects: false
modifyOutputPath: false
projects: '**/apps/**/*-uninstaller/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)\zero_build\bin /p:SignHash=$(signHash)'
zipAfterPublish: false
- task: PowerShell@2
displayName: Generate migration SQL
inputs:
filePath: $(Build.SourcesDirectory)\src\data\src\Eryph.StateDb.Design\Generate-MigrationSql.ps1
arguments: -Output $(Build.ArtifactStagingDirectory)\zero_build\migrations
workingDirectory: $(Build.SourcesDirectory)\src\data\src\Eryph.StateDb.Design\
pwsh: true
- task: AzureCLI@2
displayName: 'Sign executables'
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
scriptType: ps
scriptLocation: inlineScript
azureSubscription: 'dbosoft Azure PN'
addSpnToEnvironment: true
workingDirectory: '$(Build.ArtifactStagingDirectory)\zero_build\bin'
inlineScript: |
AzureSignTool sign -kvu "https://dbosoft-hsm-vault.vault.azure.net" -kvi $Env:servicePrincipalId -kvt $Env:tenantId -kvs $Env:servicePrincipalKey -tr http://rfc3161timestamp.globalsign.com/advanced -kvc "codesigning-2023" -v eryph-zero.exe
AzureSignTool sign -kvu "https://dbosoft-hsm-vault.vault.azure.net" -kvi $Env:servicePrincipalId -kvt $Env:tenantId -kvs $Env:servicePrincipalKey -tr http://rfc3161timestamp.globalsign.com/advanced -kvc "codesigning-2023" -v eryph-uninstaller.exe
- task: CopyFiles@2
displayName: copy ovs package to zero build
inputs:
Contents: 'ovspackage.zip'
TargetFolder: '$(Build.ArtifactStagingDirectory)\zero_build'
- task: ArchiveFiles@2
displayName: pack zero build
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\zero_build'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/apps/zero/eryph_zero_$(Build.BuildNumber)_windows_amd64.zip'
- task: PublishBuildArtifacts@1
displayName: upload zero artifact
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/apps/zero'
ArtifactName: 'zero'
- job: test
pool:
vmImage: ubuntu-22.04
variables:
- name: buildConfiguration
value: 'Release'
steps:
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
# We exclude projects which require Windows to avoid errors
projects: '**/test/**/!(*VmHostAgent*|*VmManagement*).csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage" --no-build --filter "Category=Docker"'