forked from python-trio/trio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
90 lines (80 loc) · 2.61 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
def configs = [
[
label: 'sierra',
pyversions: ['python3.5', 'python3.6'],
],
]
def checkout_git(label) {
retry(3) {
def script = ""
if (env.BRANCH_NAME.startsWith('PR-')) {
script = """
git clone --depth=1 https://github.com/python-trio/trio
cd trio
git fetch origin +refs/pull/${env.CHANGE_ID}/merge:
git checkout -qf FETCH_HEAD
"""
sh """#!/bin/sh
set -xe
${script}
"""
} else {
checkout([
$class: 'GitSCM',
branches: [[name: "*/${env.BRANCH_NAME}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'trio'
]],
submoduleCfg: [],
userRemoteConfigs: [[
'url': 'https://github.com/python-trio/trio'
]]
])
}
}
}
def build(pyversion, label) {
try {
timeout(time: 30, unit: 'MINUTES') {
checkout_git(label)
withCredentials([string(credentialsId: 'python-trio-codecov-token', variable: 'CODECOV_TOKEN')]) {
withEnv(["LABEL=$label", "PYVERSION=$pyversion"]) {
ansiColor {
sh """#!/usr/bin/env bash
set -xe
# Jenkins logs in as a non-interactive shell, so we don't even have /usr/local/bin in PATH
export PATH="/usr/local/bin:\${PATH}"
export PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:\${PATH}"
export PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:\${PATH}"
cd trio
$PYVERSION -m venv .venv
source .venv/bin/activate
source ci/travis.sh
"""
}
}
}
}
} finally {
deleteDir()
}
}
def builders = [:]
for (config in configs) {
def label = config["label"]
def pyversions = config["pyversions"]
for (_pyversion in pyversions) {
def pyversion = _pyversion
def combinedName = "${label}-${pyversion}"
builders[combinedName] = {
node(label) {
stage(combinedName) {
build(pyversion, label)
}
}
}
}
}
parallel builders