-
Notifications
You must be signed in to change notification settings - Fork 14
/
azure-pipelines.yml
103 lines (86 loc) · 2.96 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
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
stages:
- stage: test
jobs:
- job: sonar
displayName: Analyse code with SonarQube
steps:
- task: SonarCloudPrepare@2
displayName: 'Prepare SonarCloud analysis'
inputs:
SonarCloud: 'SonarCloud'
organization: 'aqualityautomation'
scannerMode: 'MSBuild'
projectKey: 'aquality-automation_aquality-selenium-dotnet'
projectName: 'aquality-selenium-dotnet'
projectVersion: '$(Build.BuildNumber)'
extraProperties: |
sonar.coverage.exclusions=**/**
- task: DotNetCoreCLI@2
displayName: 'Build solution'
env:
MSBUILDSINGLELOADCONTEXT: 1 # https://github.com/SpecFlowOSS/SpecFlow/issues/1912
inputs:
command: 'build'
projects: Aquality.Selenium/Aquality.Selenium.sln
arguments: -c $(buildConfiguration)
- task: SonarCloudAnalyze@2
displayName: 'Run SonarCloud code analysis'
continueOnError: true
inputs:
jdkversion: 'JAVA_HOME_17_X64'
- task: SonarCloudPublish@2
displayName: 'Publish SonarCloud quality gate results'
inputs:
pollingTimeoutSec: '300'
- job: tests
displayName: Run tests
variables:
profile: 'azure'
steps:
- task: DotNetCoreCLI@2
displayName: 'Run tests'
retryCountOnTaskFailure: 1
inputs:
command: 'test'
projects: '**/*Tests*/*.csproj'
arguments: -c $(buildConfiguration)
publishTestResults: true
- stage: deploy
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: release
displayName: 'Create tag on GitHub and publish NuGet package'
steps:
- task: gitversion/setup@0
displayName: 'Install GitTools'
inputs:
versionSpec: '5.x'
- task: gitversion/execute@0
inputs:
useConfigFile: true
configFilePath: 'GitVersion.yml'
- script: dotnet pack Aquality.Selenium\Aquality.Selenium.sln -c $(buildConfiguration) -p:Version=$(GitVersion.NuGetVersion) -o $(Build.ArtifactStagingDirectory)
displayName: 'Pack to NuGet package'
- task: GitHubRelease@0
displayName: 'Create tag on GitHub'
inputs:
gitHubConnection: 'github.com_aqualityautomation'
repositoryName: 'aquality-automation/aquality-selenium-dotnet'
action: 'create'
tag: 'v$(GitVersion.NuGetVersion)'
title: 'v$(GitVersion.NuGetVersion)'
tagSource: 'manual'
isPreRelease: contains(variables['GitVersion.NuGetVersion'], '-')
- task: NuGetCommand@2
displayName: 'Push NuGet package'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/Aquality.Selenium*.nupkg;!$(Build.ArtifactStagingDirectory)/**/Aquality.Selenium*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet'