-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
65 lines (58 loc) · 2.1 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
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- master
pool:
vmImage: ubuntu-latest
variables:
TUNNEL_NAME: 'sauce-tunnel-eu'
BUILD_NAME: $(Build.DefinitionName):$(Build.BuildId)
steps:
- task: CmdLine@2
inputs:
script: |
curl https://saucelabs.com/downloads/sc-4.6.5-linux.tar.gz | tar -xz
chmod 777 -R ./sc-4.6.5-linux
PATH=./sc-4.6.5-linux/bin:$PATH
sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -x "https://eu-central-1.saucelabs.com/rest/v1" -i $TUNNEL_NAME -v -s &
displayName: 'install and start sauce tunnel'
env:
SAUCE_USERNAME: $(sauceUsername)
SAUCE_ACCESS_KEY: $(sauceAccessKey)
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'clean install'
options: '-Dregion=eu -DtestngXmlFile=web_local_desktop_test.xml'
displayName: 'run suite on Sauce desktop'
env:
SAUCE_USERNAME: $(sauceUsername)
SAUCE_ACCESS_KEY: $(sauceAccessKey)
- task: CmdLine@2
inputs:
script: |
kill -SIGINT $(ps aux | grep sauce-tunnel-eu | grep -v grep | awk '{ print $2 }')
echo "** sleep 5 **"
sleep 5
displayName: 'kill tunnel'
- task: CmdLine@2
inputs:
script: |
echo "build name is " + $BUILD_NAME
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location --request GET "https://api.eu-central-1.saucelabs.com/v1/analytics/trends/builds_tests?time_range=1h" | jq '.builds .items' | jq --arg BUILD_NAME "$BUILD_NAME" '.[] | select(.name == $BUILD_NAME)' | jq '.tests' | jq '.[]' | jq '.name ,.id , .status ' > results.txt
displayName: 'Create result file'
env:
SAUCE_USERNAME: $(sauceUsername)
SAUCE_ACCESS_KEY: $(sauceAccessKey)
- task: PublishPipelineArtifact@1
inputs:
targetPath: results.txt
artifactName: SauceLabs_Results