-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
148 lines (124 loc) · 4.18 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
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-winappdriver-dotnet'
projectName: 'aquality-winappdriver-dotnet'
projectVersion: '$(Build.BuildNumber)'
extraProperties: |
sonar.coverage.exclusions=**/**
- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: Aquality.WinAppDriver/Aquality.WinAppDriver.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:
isRemote: true
steps:
- task: ScreenResolutionUtility@1
displayName: 'Set up screen resolution 1920x1080'
inputs:
displaySettings: 'specific'
width: '1920'
height: '1080'
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '16.x'
- task: CmdLine@2
displayName: 'Install Appium'
inputs:
script: |
echo "Installing Appium"
npm install -g appium@next
appium --version
echo "Appium installed"
- task: CmdLine@2
displayName: 'Install and Run Appium doctor'
inputs:
script: |
echo "Installing and Running Appium doctor"
npm install -g [email protected]
npm install -g [email protected]
appium-doctor
echo "Appium doctor installed and executed"
- task: CmdLine@2
displayName: 'Install Appium Windows Driver'
inputs:
script: |
echo "Installing Appium Windows Driver"
appium driver install --source=npm appium-windows-driver
appium driver list
echo "Appium Windows Driver installed"
- task: CmdLine@2
displayName: 'Start Appium server'
inputs:
script: |
start cmd.exe @cmd /k "appium"
echo "Appium server started"
- 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
inputs:
versionSpec: '5.x'
- task: gitversion/execute@0
inputs:
useConfigFile: true
configFilePath: 'GitVersion.yml'
- script: dotnet pack Aquality.WinAppDriver\src\Aquality.WinAppDriver\Aquality.WinAppDriver.csproj -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-winappdriver-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.WinAppDriver*.nupkg;!$(Build.ArtifactStagingDirectory)/**/Aquality.WinAppDriver*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet'