forked from OneIdentity/SCALUS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
133 lines (120 loc) · 4.67 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
trigger:
- master
- release*
parameters:
- name: edition
displayName: 'Build Edition'
type: string
default: 'community'
values:
- community
- supported
name: $(Date:yyyyMMdd).$(Rev:r)_${{ parameters.edition }}
variables:
version: '1.0.0.$(Revision)'
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
codeSigningCertFileName: 'OneIdentityCodeSigning.pfx'
signingToolPath: 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit'
isRelease: $[ startswith(variables['Build.SourceBranch'], 'refs/heads/release-')]
jobs:
- job: BuildAndTest
displayName: 'Build & Test - ${{ parameters.edition }}'
pool:
vmImage: 'windows-latest'
steps:
- script: echo 'SCALUS Version - $(version)'
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:Edition="${{ parameters.edition }}" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*.Test.dll
!**\*TestAdapter.dll
!**\obj\**
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- job: Windows
dependsOn: BuildAndTest
pool:
vmImage: 'windows-latest'
steps:
- task: AzureKeyVault@1
inputs:
azureSubscription: 'Azure.Infrastructure.CodeSigning'
KeyVaultName: 'CodeSigningCertificates'
displayName: 'Get code signing certificate from Azure Key Vault'
condition: and(succeeded(), eq(variables.isRelease, true))
- powershell: |
$kvSecretBytes = [System.Convert]::FromBase64String("$(OneIdentity-CodeSigning)")
$certCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection
$certCollection.Import($kvSecretBytes,$null,[System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
$protectedCertificateBytes = $certCollection.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12,"$(OneIdentity-CodeSigningCertPassword)")
$certpath = '$(Build.BinariesDirectory)/$(codeSigningCertFileName)'
Write-Verbose -Verbose $certpath
[System.IO.File]::WriteAllBytes($certpath, $protectedCertificateBytes)
displayName: 'Save code signing certificate to PFX file'
condition: and(succeeded(), eq(variables.isRelease, true))
- task: Cake@2
inputs:
script: 'build.cake'
target: 'Default'
verbosity: 'Verbose'
arguments: '--runtime=win10-x64 --Edition=${{ parameters.edition }} --Version=$(version) --SignFiles=$(isRelease) --CertPath="$(Build.BinariesDirectory)/$(codeSigningCertFileName)" --ToolPath="$(signingToolPath)" --CertPass=$(OneIdentity-CodeSigningCertPassword)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/Output/Release/win10-x64'
artifact: 'Scalus-Win10'
publishLocation: 'pipeline'
- task: DeleteFiles@1
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '$(codeSigningCertFileName)'
condition: succeededOrFailed()
displayName: 'Delete code signing certificate files'
- job: Linux
dependsOn: BuildAndTest
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Cake@2
inputs:
script: 'build.cake'
target: 'Default'
verbosity: 'Verbose'
arguments: '--runtime=linux-x64 --Edition=${{ parameters.edition }} --Version=$(version)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/Output/Release/linux-x64'
artifact: 'Scalus-Linux'
publishLocation: 'pipeline'
- job: Mac
dependsOn: BuildAndTest
pool:
vmImage: 'macOS-latest'
steps:
- task: Cake@2
inputs:
script: 'build.cake'
target: 'Default'
verbosity: 'Verbose'
arguments: '--runtime=osx-x64 --Edition=${{ parameters.edition }} --Version=$(version)'
- task: Bash@3
inputs:
filePath: '$(Pipeline.Workspace)/s/scripts/Osx/package.sh'
arguments: '--version $(version) --runtime osx-x64 --infile $(Pipeline.Workspace)/s/scripts/Osx/applet --outpath $(Pipeline.Workspace)/s/Output/Release/osx-x64 --publishdir $(Pipeline.Workspace)/s/Publish/Release/osx-x64'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/Output/Release/osx-x64'
artifact: 'Scalus-Osx'
publishLocation: 'pipeline'