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 74
/
Jenkinsfile
95 lines (92 loc) · 2.28 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
91
92
93
94
95
#!/usr/bin/env groovy
def branch = env.BRANCH_NAME ?: 'master'
/** Desired capabilities */
def capabilities = [
browserName: 'Firefox',
version: '65.0',
platform: 'Windows 10'
]
pipeline {
agent any
libraries {
lib('[email protected]')
}
triggers {
pollSCM(branch == 'master' ? 'H/5 * * * *' : '')
cron(branch == 'master' ? 'H H * * *' : '')
}
options {
ansiColor('xterm')
timestamps()
timeout(time: 1, unit: 'HOURS')
}
stages {
stage('Lint') {
agent {
dockerfile true
}
steps {
sh "flake8"
}
}
stage('Test') {
agent {
dockerfile true
}
environment {
VARIABLES = credentials('MOZILLIANS_VARIABLES')
PYTEST_PROCESSES = "${PYTEST_PROCESSES ?: "auto"}"
PULSE = credentials('PULSE')
SAUCELABS = credentials('SAUCELABS')
}
steps {
writeCapabilities(capabilities, 'capabilities.json')
sh "pytest " +
"-n=${PYTEST_PROCESSES} " +
"--tb=short " +
"--color=yes " +
"--driver=SauceLabs " +
"--variables=capabilities.json " +
"--variables=${VARIABLES} " +
"--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('mozillians-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')
}
}
}