forked from OpenRIAServices/OpenRiaServices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
160 lines (137 loc) · 4.92 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
pool:
vmImage: 'windows-2022'
variables:
BuildConfiguration: 'release'
BuildPlatform: 'any cpu'
Solution: 'src\RiaServices.sln'
# Msbuild might create logs in the following directory in case some of the "tool" tests fail
MSBUILDDEBUGPATH: $(Build.ArtifactStagingDirectory)
# Define the following variable for the build pipeline in order to enable sonarcloud analysis
# sonarcloud-endpoint: 'sonarcloud.io'
steps:
# Uncomment below to install dotnet runtime and SDK if they stop beeing preinstalled
## install dotnet 6
#- task: UseDotNet@2
# inputs:
# packageType: 'runtime'
# version: '6.0.x'
## install dotnet 8 sdk
#- task: UseDotNet@2
# inputs:
# packageType: 'sdk'
# version: '8.0.x'
- task: NuGetToolInstaller@1
inputs:
versionSpec: 6.9.1
- task: gitversion/setup@3
inputs:
versionSpec: '5.9.0'
- task: gitversion/execute@3
displayName: Use GitVersion
- task: NuGetCommand@2
displayName: 'NuGet restore RiaServices.sln'
inputs:
restoreSolution: '$(Solution)'
configuration: '$(BuildConfiguration)'
- task: SonarCloudPrepare@3
displayName: 'Prepare analysis on SonarCloud'
condition: variables['sonarcloud-endpoint']
inputs:
SonarCloud: 'sonarcloud.io'
organization: 'openriaservices'
scannerMode: 'dotnet'
projectKey: 'OpenRIAServices_OpenRiaServices'
projectName: 'OpenRiaServices'
projectVersion: '$(Build.BuildNumber)'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
- task: VSBuild@1
displayName: 'Build solution RiaServices.sln'
inputs:
solution: '$(Solution)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
maximumCpuCount: true
# Load test databases and setup msbuild debug path so it becomes part of artifacts
- powershell: |
sqllocaldb start MSSQLLocalDB
if (-not $?) { write-error "failed to start MSSQLLocalDB" }
.\Setup-TestDatabases.ps1
displayName: 'Setup database'
- task: VSTest@2
displayName: 'Run tests - net48'
inputs:
testAssemblyVer2: |
**\bin\$(BuildConfiguration)\net4*\OpenRiaServices.*Test.dll
!src\VisualStudio\**\bin\$(BuildConfiguration)\net4*\OpenRiaServices.*Test.dll
!**\bin\$(BuildConfiguration)\*\OpenRiaServices.Common*Test.dll
src\VisualStudio\Tools\Test\bin\$(BuildConfiguration)\net4*\OpenRiaServices.VisualStudio.*.Test.dll
!**\obj\**
runOnlyImpactedTests: false
runInParallel: true
runSettingsFile: 'src\test.runsettings'
codeCoverageEnabled: true
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
timeoutInMinutes: 25
- task: VSTest@2
displayName: 'Run tests - net6'
inputs:
testAssemblyVer2: |
**\bin\$(BuildConfiguration)\*\OpenRiaServices.*Test.dll
!**\bin\$(BuildConfiguration)\*\OpenRiaServices.Common*Test.dll
!**\bin\$(BuildConfiguration)\net4*\OpenRiaServices.*Test.dll
!**\obj\**
runOnlyImpactedTests: false
runInParallel: true
runSettingsFile: 'src\test.runsettings'
codeCoverageEnabled: true
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
timeoutInMinutes: 25
- task: SonarCloudAnalyze@3
inputs:
jdkversion: 'JAVA_HOME_21_X64'
displayName: 'Run Code Analysis'
continueOnError: true
condition: and(variables['sonarcloud-endpoint'], or(succeeded(), and(succeededOrFailed(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))))
- task: NuGetCommand@2
displayName: 'NuGet pack'
inputs:
command: pack
packagesToPack: 'NuGet\**\*.nuspec'
versioningScheme: byEnvVar
versionEnvVar: Build.BuildNumber
packDestination: '$(Build.ArtifactStagingDirectory)'
continueOnError: true
# condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: CopyFiles@2
displayName: 'Copy VS Extension: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: |
src\VisualStudio\Installer\bin\$(BuildConfiguration)\*.vsix
src\VisualStudio\Installer\publishManifest.json
src\VisualStudio\Installer\assets\**
TargetFolder: '$(build.artifactstagingdirectory)'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: CopyFiles@2
displayName: 'Copy dump files to $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: |
TestResults/*/*
**/*.diag
!TestResults/*/*.coverage*
TargetFolder: '$(build.artifactstagingdirectory)/vstest'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: SonarCloudPublish@3
displayName: 'Publish Quality Gate Result'
continueOnError: true
condition: and(variables['sonarcloud-endpoint'], or(succeeded(), and(succeededOrFailed(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))))