This repository has been archived by the owner on Feb 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Jenkinsfile
90 lines (87 loc) · 2.15 KB
/
Jenkinsfile
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
#!/usr/bin/env groovy
def branch = env.BRANCH_NAME ?: 'master'
/** Desired capabilities */
def capabilities = [
browserName: 'Chrome',
platform: 'Windows 10'
]
pipeline {
agent any
libraries {
lib('[email protected]')
}
triggers {
pollSCM(branch == 'master' ? 'H/30 * * * *' : '')
cron(branch == 'master' ? 'H * * * *' : '')
}
options {
ansiColor('xterm')
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Lint') {
agent {
dockerfile true
}
steps {
sh "flake8"
}
}
stage('Test') {
agent {
dockerfile true
}
environment {
PYTEST_PROCESSES = "${PYTEST_PROCESSES ?: "auto"}"
PULSE = credentials('PULSE')
SAUCELABS = credentials('SAUCELABS')
}
steps {
writeCapabilities(capabilities, 'capabilities.json')
sh "pytest " +
"-n=${PYTEST_PROCESSES} " +
"--showlocals " +
"--color=yes " +
"--driver=SauceLabs " +
"--variables=capabilities.json " +
"--junit-xml=results/junit.xml --html=results/index.html --self-contained-html " +
"--log-raw=results/raw.txt " +
"--log-tbpl=results/tbpl.txt"
}
post {
always {
stash includes: 'results/*', name: 'results'
archiveArtifacts 'results/*'
junit 'results/*.xml'
submitToActiveData('results/raw.txt')
submitToTreeherder('stubattribution-tests', 'e2e', 'End-to-end integration tests', 'results/*', 'results/tbpl.txt')
}
}
}
}
post {
always {
unstash 'results'
publishHTML(target: [
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'results',
reportFiles: "index.html",
reportName: 'HTML Report'])
}
changed {
ircNotification()
}
failure {
emailext(
attachLog: true,
attachmentsPattern: 'results/index.html',
body: '$BUILD_URL\n\n$FAILED_TESTS',
replyTo: '$DEFAULT_REPLYTO',
subject: '$DEFAULT_SUBJECT',
to: '$DEFAULT_RECIPIENTS')
}
}
}