66
77variables :
88 buildConfiguration : ' Release'
9- profile : ' azure'
10-
11- steps :
12- - task : GitVersion@5
13- displayName : ' Run GitVersion'
14- inputs :
15- runtime : ' core'
16-
17- - task : SonarCloudPrepare@1
18- displayName : ' Prepare SonarCloud analysis'
19- inputs :
20- SonarCloud : ' SonarCloud'
21- organization : ' aqualityautomation'
22- projectKey : ' aquality-automation_aquality-selenium-dotnet'
23- projectName : ' aquality-selenium-dotnet'
24- projectVersion : ' $(Build.BuildNumber)'
25- extraProperties : |
26- sonar.coverage.exclusions=**/**
27-
28- - script : dotnet build Aquality.Selenium/Aquality.Selenium.sln -c $(buildConfiguration)
29- displayName : ' Build solution - $(buildConfiguration)'
30-
31- - task : SonarCloudAnalyze@1
32- displayName : ' Run SonarCloud code analysis'
33- continueOnError : true
34-
35- - task : SonarCloudPublish@1
36- displayName : ' Publish SonarCloud quality gate results'
37- continueOnError : true
38-
39- - task : DotNetCoreCLI@2
40- displayName : ' Run tests'
41- inputs :
42- command : ' test'
43- projects : ' **/*Tests*/*.csproj'
44- arguments : -c $(buildConfiguration) --no-build
45- publishTestResults : true
46-
47- - script : dotnet pack Aquality.Selenium\src\Aquality.Selenium\Aquality.Selenium.csproj -c $(buildConfiguration) --no-build -p:Version=$(GitVersion.NuGetVersion) -o $(Build.ArtifactStagingDirectory)
48- displayName : ' Pack to NuGet package'
49- condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
509
51- - task : GitHubRelease@0
52- displayName : ' Create tag on GitHub'
53- inputs :
54- gitHubConnection : ' GitHub'
55- repositoryName : ' aquality-automation/aquality-selenium-dotnet'
56- action : ' create'
57- tag : ' v$(GitVersion.NuGetVersion)'
58- tagSource : ' manual'
59- isPreRelease : contains(variables['GitVersion.NuGetVersion'], '-')
10+ stages :
11+ - stage : test
12+
13+ jobs :
14+ - job : sonar
15+ displayName : Analyse code with SonarQube
16+
17+ steps :
18+ - task : SonarCloudPrepare@1
19+ displayName : ' Prepare SonarCloud analysis'
20+ inputs :
21+ SonarCloud : ' SonarCloud'
22+ organization : ' aqualityautomation'
23+ projectKey : ' aquality-automation_aquality-selenium-dotnet'
24+ projectName : ' aquality-selenium-dotnet'
25+ projectVersion : ' $(Build.BuildNumber)'
26+ extraProperties : |
27+ sonar.coverage.exclusions=**/**
28+
29+ - task : DotNetCoreCLI@2
30+ displayName : ' Build solution'
31+ inputs :
32+ command : ' build'
33+ projects : Aquality.Selenium/Aquality.Selenium.sln
34+ arguments : -c $(buildConfiguration)
35+
36+ - task : SonarCloudAnalyze@1
37+ displayName : ' Run SonarCloud code analysis'
38+ continueOnError : true
39+
40+ - task : SonarCloudPublish@1
41+ displayName : ' Publish SonarCloud quality gate results'
42+
43+ - job : tests
44+ displayName : Run tests
45+
46+ variables :
47+ profile : ' azure'
48+
49+ steps :
50+ - task : DotNetCoreCLI@2
51+ displayName : ' Run tests'
52+ inputs :
53+ command : ' test'
54+ projects : ' **/*Tests*/*.csproj'
55+ arguments : -c $(buildConfiguration)
56+ publishTestResults : true
57+
58+ - stage : deploy
6059 condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
6160
62- - task : PublishBuildArtifacts@1
63- inputs :
64- targetPath : ' $(Build.ArtifactStagingDirectory)'
65- artifactName : ' _aquality-automation.aquality-selenium-dotnet'
66- condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
61+ jobs :
62+ - job : release
63+ displayName : ' Create tag on GitHub and publish NuGet package'
64+
65+ steps :
66+ - task : GitVersion@5
67+ displayName : ' Run GitVersion'
68+ inputs :
69+ runtime : ' core'
70+
71+ - script : dotnet pack Aquality.Selenium\src\Aquality.Selenium\Aquality.Selenium.csproj -c $(buildConfiguration) -p:Version=$(GitVersion.NuGetVersion) -o $(Build.ArtifactStagingDirectory)
72+ displayName : ' Pack to NuGet package'
73+
74+ - task : GitHubRelease@0
75+ displayName : ' Create tag on GitHub'
76+ inputs :
77+ gitHubConnection : ' GitHub'
78+ repositoryName : ' aquality-automation/aquality-selenium-dotnet'
79+ action : ' create'
80+ tag : ' v$(GitVersion.NuGetVersion)'
81+ title : ' v$(GitVersion.NuGetVersion)'
82+ tagSource : ' manual'
83+ isPreRelease : contains(variables['GitVersion.NuGetVersion'], '-')
84+
85+ - task : NuGetCommand@2
86+ displayName : ' Push NuGet package'
87+ inputs :
88+ command : ' push'
89+ packagesToPush : ' $(Build.ArtifactStagingDirectory)/**/Aquality.Selenium*.nupkg;!$(Build.ArtifactStagingDirectory)/**/Aquality.Selenium*.symbols.nupkg'
90+ nuGetFeedType : ' external'
91+ publishFeedCredentials : ' NuGet'
0 commit comments