Skip to content

Commit c92150d

Browse files
authored
PYTHON-1631 Automate release wheels for Windows and manylinux (#473)
1 parent b04e334 commit c92150d

File tree

6 files changed

+149
-2
lines changed

6 files changed

+149
-2
lines changed

.evergreen/build-mac.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash -ex
2+
3+
for VERSION in 2.7 3.4 3.5 3.6 3.7 3.8; do
4+
if [[ $VERSION == "2.7" ]]; then
5+
rm -rf build
6+
python$VERSION setup.py bdist_egg
7+
fi
8+
rm -rf build
9+
python$VERSION setup.py bdist_wheel
10+
done
11+
12+
ls dist
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash -ex
2+
cd /pymongo
3+
4+
# Compile wheels
5+
for PYBIN in /opt/python/*/bin; do
6+
# Skip Python 3.3 and 3.9.
7+
if [[ "$PYBIN" == *"cp33"* || "$PYBIN" == *"cp39"* ]]; then
8+
continue
9+
fi
10+
# https://github.com/pypa/manylinux/issues/49
11+
rm -rf build
12+
${PYBIN}/python setup.py bdist_wheel
13+
done
14+
15+
# https://github.com/pypa/manylinux/issues/49
16+
rm -rf build
17+
18+
# Audit wheels and write multilinux1 tag
19+
for whl in dist/*.whl; do
20+
# Skip already built manylinux1 wheels.
21+
if [[ "$whl" != *"manylinux"* ]]; then
22+
auditwheel repair $whl -w dist
23+
rm $whl
24+
fi
25+
done

.evergreen/build-manylinux.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash -ex
2+
3+
docker version
4+
5+
# 2020-03-20-2fda31c Was the last release to include Python 3.4.
6+
images=(quay.io/pypa/manylinux1_x86_64:2020-03-20-2fda31c \
7+
quay.io/pypa/manylinux1_i686:2020-03-20-2fda31c \
8+
quay.io/pypa/manylinux1_x86_64 \
9+
quay.io/pypa/manylinux1_i686 \
10+
quay.io/pypa/manylinux2014_x86_64 \
11+
quay.io/pypa/manylinux2014_i686)
12+
# aarch64/ppc64le/s390x work on macOS locally but not on linux in evergreen:
13+
# [2020/07/23 00:24:00.482] + docker run --rm -v /data/mci/cd100cec6341abda533450fb3f2fab99/src:/pymongo quay.io/pypa/manylinux2014_aarch64 /pymongo/.evergreen/build-manylinux-internal.sh
14+
# [2020/07/23 00:24:01.186] standard_init_linux.go:211: exec user process caused "exec format error"
15+
#
16+
# Could be related to:
17+
# https://github.com/pypa/manylinux/issues/410
18+
# quay.io/pypa/manylinux2014_aarch64 \
19+
# quay.io/pypa/manylinux2014_ppc64le \
20+
# quay.io/pypa/manylinux2014_s390x)
21+
22+
for image in "${images[@]}"; do
23+
docker pull $image
24+
docker run --rm -v `pwd`:/pymongo $image /pymongo/.evergreen/build-manylinux-internal.sh
25+
done
26+
27+
ls dist
28+
29+
# Check for any unexpected files.
30+
unexpected=$(find dist \! \( -iname dist -or \
31+
-iname '*cp27*' -or \
32+
-iname '*cp34*' -or \
33+
-iname '*cp35*' -or \
34+
-iname '*cp36*' -or \
35+
-iname '*cp37*' -or \
36+
-iname '*cp38*' \))
37+
if [ -n "$unexpected" ]; then
38+
echo "Unexpected files:" $unexpected
39+
exit 1
40+
fi

.evergreen/build-windows.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash -ex
2+
3+
for VERSION in 27 34 35 36 37 38; do
4+
PYTHON=C:/Python/Python${VERSION}/python.exe
5+
PYTHON32=C:/Python/32/Python${VERSION}/python.exe
6+
if [[ $VERSION == "2.7" ]]; then
7+
rm -rf build
8+
$PYTHON setup.py bdist_egg
9+
rm -rf build
10+
$PYTHON32 setup.py bdist_egg
11+
fi
12+
rm -rf build
13+
$PYTHON setup.py bdist_wheel
14+
rm -rf build
15+
$PYTHON32 setup.py bdist_wheel
16+
done
17+
18+
ls dist

.evergreen/config.yml

+45-2
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,13 @@ functions:
756756
-v \
757757
--fault revoked
758758
759+
"teardown_docker":
760+
- command: shell.exec
761+
params:
762+
script: |
763+
# Remove all Docker images
764+
docker rmi -f $(docker images -a -q) &> /dev/null || true
765+
759766
pre:
760767
- func: "fetch source"
761768
- func: "prepare resources"
@@ -773,6 +780,7 @@ post:
773780
- func: "upload test results"
774781
- func: "stop mongo-orchestration"
775782
- func: "cleanup"
783+
- func: "teardown_docker"
776784

777785
tasks:
778786

@@ -806,6 +814,36 @@ tasks:
806814
genhtml --version || true
807815
valgrind --version || true
808816
817+
818+
- name: "release"
819+
tags: ["release"]
820+
git_tag_only: true
821+
commands:
822+
- command: shell.exec
823+
type: test
824+
params:
825+
working_dir: "src"
826+
script: |
827+
set -o xtrace
828+
${PREPARE_SHELL}
829+
.evergreen/release.sh
830+
- command: archive.targz_pack
831+
params:
832+
target: "release-files.tgz"
833+
source_dir: "src/dist"
834+
include:
835+
- "*"
836+
- command: s3.put
837+
params:
838+
aws_key: ${aws_key}
839+
aws_secret: ${aws_secret}
840+
local_file: release-files.tgz
841+
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/release/${task_id}-${execution}-release-files.tar.gz
842+
bucket: mciuploads
843+
permissions: public-read
844+
content_type: ${content_type|application/gzip}
845+
display_name: Release files
846+
809847
# Standard test tasks {{{
810848

811849
- name: "mockupdb"
@@ -2065,8 +2103,6 @@ buildvariants:
20652103
- ".latest"
20662104
- ".4.4"
20672105
- ".4.2"
2068-
variables:
2069-
set_xtrace_on: on
20702106

20712107
- matrix_name: "tests-python-version-rhel62-test-ssl"
20722108
matrix_spec:
@@ -2519,6 +2555,13 @@ buildvariants:
25192555
- name: "aws-auth-test-4.4"
25202556
- name: "aws-auth-test-latest"
25212557

2558+
- matrix_name: "Release"
2559+
matrix_spec:
2560+
platform: [ubuntu-18.04, windows-64-vsMulti-small]
2561+
display_name: "Release ${platform}"
2562+
tasks:
2563+
- name: "release"
2564+
25222565
# Platform notes
25232566
# i386 builds of OpenSSL or Cyrus SASL are not available
25242567
# Ubuntu16.04 ppc64le is only supported by MongoDB 3.4+

.evergreen/release.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash -ex
2+
3+
if [ $(uname -s) = "Darwin" ]; then
4+
.evergreen/build-mac.sh
5+
elif [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
6+
.evergreen/build-windows.sh
7+
else
8+
.evergreen/build-manylinux.sh
9+
fi

0 commit comments

Comments
 (0)