-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure-pipelines.yml
146 lines (126 loc) · 4.73 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
trigger:
- master
pool:
vmImage: 'macOS-latest'
jobs:
- job: sonar
displayName: Analyse code with SonarQube
steps:
- task: SonarCloudPrepare@1
displayName: 'Prepare SonarCloud analysis'
inputs:
SonarCloud: 'SonarCloud'
organization: 'aqualityautomation'
scannerMode: 'CLI'
configMode: 'file'
extraProperties: |
sonar.coverage.exclusions=**/**
- task: Maven@3
displayName: 'Compile project'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean compile'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
continueOnError: true
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud code analysis'
continueOnError: true
- task: SonarCloudPublish@1
displayName: 'Publish SonarCloud quality gate results'
- job: tests
displayName: Run tests
strategy:
maxParallel: 2
matrix:
REMOTE_SERVER:
isRemote: true
LOCAL_SERVER:
isRemote: false
variables:
ANDROID_EMU_NAME: test
ANDROID_SDK_ID: system-images;android-28;google_apis_playstore;x86
steps:
- task: CmdLine@2
displayName: 'Configure Appium and Android SDK'
inputs:
script: |
echo "Configuring Environment"
export PATH=$PATH:$JAVA_HOME/bin
echo export "ANDROID_HOME=\$ANDROID_HOME" >> ~/.bash_profile
export PATH=$PATH:$ANDROID_HOME
echo "ANDROID_HOME: ${ANDROID_HOME}"
echo "JAVA_HOME: ${JAVA_HOME}"
echo "PATH: ${PATH}"
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager "$(ANDROID_SDK_ID)"
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n "$(ANDROID_EMU_NAME)" -k "$(ANDROID_SDK_ID)" -f
$ANDROID_HOME/emulator/emulator -list-avds
echo "Starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd "$(ANDROID_EMU_NAME)" -gpu swiftshader_indirect -noaudio -no-boot-anim -no-snapshot > /dev/null 2>&1 &
$ANDROID_HOME/platform-tools/adb wait-for-device
while [[ $? -ne 0 ]]; do sleep 1; $ANDROID_HOME/platform-tools/adb shell pm list packages; done;
$ANDROID_HOME/platform-tools/adb devices
echo "Emulator started"
echo "Installing Appium"
npm install -g appium@next
ln -fs /usr/local/lib/node_modules/appium/build/lib/main.js /usr/local/bin/appium
chmod +x /usr/local/bin/appium
export PATH=$PATH:/usr/local/bin/appium
appium --version
echo "Appium installed"
echo "Installing UIA2 driver"
appium driver install uiautomator2
appium driver list
echo "UIA2 driver installed"
echo "Installing and Running Appium doctor"
npm install -g [email protected]
npm install @appium/doctor -g
ln -fs /usr/local/lib/node_modules/appium-doctor/appium-doctor.js /usr/local/bin/appium-doctor
chmod +x /usr/local/bin/appium-doctor
export PATH=$PATH:/usr/local/bin/appium-doctor
appium-doctor
echo "Appium doctor installed and executed"
#sudo xcode-select -s /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
#xcrun simctl list
- task: CmdLine@2
displayName: 'Start Appium server'
inputs:
script: |
appium --allow-insecure chromedriver_autodownload --base-path /wd/hub &
echo "Appium server started"
condition: eq(variables['isRemote'], 'true')
- task: Maven@3
displayName: 'Run tests'
inputs:
mavenPomFile: 'pom.xml'
goals: 'test -DisRemote=$(isRemote)'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
- task: CopyFiles@2
displayName: 'Copy failure screenshots and test logs'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/target'
Contents: |
surefire-reports/failure_screenshots/*.png
log/*.log
TargetFolder: '$(Build.ArtifactStagingDirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish copied artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
condition: succeededOrFailed()