-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
150 lines (134 loc) · 3.63 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
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
147
148
149
150
pipeline
{
// Only run on systems where we know we can build wheels already.
agent { label 'wheel-builder' }
environment
{
MLPACK_VERSION = '4.5.1'
TWINE_PYPI_TOKEN = credentials('twine-pypi-token')
}
// We assume that the wheel-builder system already has cibuildwheel, twine,
// and other dependencies installed and up-to-date.
stages
{
stage('Checkout and configure Python bindings')
{
steps
{
sh '''
git clone https://github.com/mlpack/mlpack
cd mlpack/
git checkout $MLPACK_VERSION
mkdir build/
cd build/
cmake -DBUILD_PYTHON_BINDINGS=ON ../
make python_configured
'''
stash includes: 'mlpack/**', name: 'mlpack-configured'
}
}
stage('Run cibuildwheel')
{
matrix
{
agent { label 'wheel-builder' }
axes
{
axis
{
name 'PYTHON_VERSION'
values 'cp38', 'cp39', 'cp310', 'cp311', 'cp312', 'cp313',
'pp37', 'pp38', 'pp39'
}
axis
{
name 'ARCH'
values 'x86_64', 'i686'
}
axis
{
name 'PYTHON_IMAGE'
values 'manylinux', 'musllinux'
}
}
excludes
{
// s390x has a numpy build failure: "error: 'HWCAP_S390_VX'
// undeclared".
exclude
{
axis
{
name 'ARCH'
values 's390x'
}
}
// The pp* targets are not available with musllinux.
exclude
{
axis
{
name 'PYTHON_VERSION'
values 'pp37', 'pp38', 'pp39'
}
axis
{
name 'PYTHON_IMAGE'
values 'musllinux'
}
}
}
stages
{
stage('Run cibuildwheel')
{
steps
{
unstash 'mlpack-configured'
// Set environment variables properly.
script
{
if (env.PYTHON_IMAGE == 'musllinux')
{
env.CIBW_BEFORE_BUILD = './build_mlpack.musl.sh'
}
else if (env.ARCH != 'x86_64' && env.ARCH != 'i686')
{
env.CIBW_BEFORE_BUILD = './build_mlpack.emulated.sh'
}
else if (env.PYTHON_IMAGE == 'manylinux' && env.ARCH == 'x86_64')
{
env.CIBW_BEFORE_BUILD = './build_mlpack.sh'
}
else if (env.PYTHON_IMAGE == 'manylinux' && env.ARCH == 'i686')
{
env.CIBW_BEFORE_BUILD = './build_mlpack.i686.sh'
}
env.CIBW_ARCHS_LINUX = env.ARCH
env.CIBW_BUILD = env.PYTHON_VERSION + '-' + env.PYTHON_IMAGE + '_' + env.ARCH
}
sh '''
echo "CIBW_BUILD: $CIBW_BUILD"
cibuildwheel --output-dir wheelhouse mlpack/build/src/mlpack/bindings/python/
'''
}
post
{
always
{
archiveArtifacts 'wheelhouse/*.whl'
sh '''
echo "[pypi]" > ~/.pypirc
echo "username = __token__" >> ~/.pypirc
echo "password = $TWINE_PYPI_TOKEN" >> ~/.pypirc
twine upload wheelhouse/*.whl
rm -f ~/.pypirc
'''
}
}
}
}
}
}
}
}