Skip to content

Commit 37b5195

Browse files
authored
PYTHON-2434 Automatically combine release wheels + sdist into one archive (#803)
1 parent 64a4f6e commit 37b5195

File tree

2 files changed

+109
-47
lines changed

2 files changed

+109
-47
lines changed

.evergreen/config.yml

+96-23
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,16 @@ functions:
870870
# Remove all Docker images
871871
docker rmi -f $(docker images -a -q) &> /dev/null || true
872872
873+
"build release":
874+
- command: shell.exec
875+
type: test
876+
params:
877+
working_dir: "src"
878+
script: |
879+
set -o xtrace
880+
${PREPARE_SHELL}
881+
.evergreen/release.sh
882+
873883
"upload release":
874884
- command: archive.targz_pack
875885
params:
@@ -882,12 +892,63 @@ functions:
882892
aws_key: ${aws_key}
883893
aws_secret: ${aws_secret}
884894
local_file: release-files.tgz
885-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/release/${task_id}-${execution}-release-files.tar.gz
895+
remote_file: ${UPLOAD_BUCKET}/release/${revision}/${task_id}-${execution}-release-files.tar.gz
886896
bucket: mciuploads
887897
permissions: public-read
888898
content_type: ${content_type|application/gzip}
889899
display_name: Release files
890900

901+
"download and merge releases":
902+
- command: shell.exec
903+
params:
904+
silent: true
905+
script: |
906+
export AWS_ACCESS_KEY_ID=${aws_key}
907+
export AWS_SECRET_ACCESS_KEY=${aws_secret}
908+
909+
# Download all the task coverage files.
910+
aws s3 cp --recursive s3://mciuploads/${UPLOAD_BUCKET}/release/${revision}/ release/
911+
- command: shell.exec
912+
params:
913+
shell: "bash"
914+
script: |
915+
set -o xtrace
916+
${PREPARE_SHELL}
917+
# Combine releases into one directory.
918+
ls -la release/
919+
mkdir releases
920+
# Copy old manylinux release first since we want the newer manylinux
921+
# wheels to override them.
922+
mkdir old_manylinux
923+
if mv release/*old_manylinux* old_manylinux; then
924+
for REL in old_manylinux/*; do
925+
tar zxvf $REL -C releases/
926+
done
927+
fi
928+
for REL in release/*; do
929+
tar zxvf $REL -C releases/
930+
done
931+
# Build source distribution.
932+
cd src/
933+
/opt/python/3.6/bin/python3 setup.py sdist
934+
cp dist/* ../releases
935+
- command: archive.targz_pack
936+
params:
937+
target: "release-files-all.tgz"
938+
source_dir: "releases/"
939+
include:
940+
- "*"
941+
- command: s3.put
942+
params:
943+
aws_key: ${aws_key}
944+
aws_secret: ${aws_secret}
945+
local_file: release-files-all.tgz
946+
remote_file: ${UPLOAD_BUCKET}/release-all/${revision}/${task_id}-${execution}-release-files-all.tar.gz
947+
bucket: mciuploads
948+
permissions: public-read
949+
content_type: ${content_type|application/gzip}
950+
display_name: Release files all
951+
891952
pre:
892953
- func: "fetch source"
893954
- func: "prepare resources"
@@ -972,22 +1033,31 @@ tasks:
9721033
genhtml --version || true
9731034
valgrind --version || true
9741035
975-
- name: "release"
976-
tags: ["release"]
1036+
- name: "release-mac"
1037+
tags: ["release_tag"]
1038+
run_on: macos-1014
1039+
commands:
1040+
- func: "build release"
1041+
- func: "upload release"
1042+
1043+
- name: "release-windows"
1044+
tags: ["release_tag"]
1045+
run_on: windows-64-vsMulti-small
1046+
commands:
1047+
- func: "build release"
1048+
- func: "upload release"
1049+
1050+
- name: "release-manylinux"
1051+
tags: ["release_tag"]
1052+
run_on: ubuntu2004-large
9771053
exec_timeout_secs: 216000 # 60 minutes (manylinux task is slow).
9781054
commands:
979-
- command: shell.exec
980-
type: test
981-
params:
982-
working_dir: "src"
983-
script: |
984-
set -o xtrace
985-
${PREPARE_SHELL}
986-
.evergreen/release.sh
1055+
- func: "build release"
9871056
- func: "upload release"
9881057

9891058
- name: "release-old-manylinux"
990-
tags: ["release"]
1059+
tags: ["release_tag"]
1060+
run_on: ubuntu2004-large
9911061
exec_timeout_secs: 216000 # 60 minutes (manylinux task is slow).
9921062
commands:
9931063
- command: shell.exec
@@ -1000,6 +1070,16 @@ tasks:
10001070
.evergreen/build-manylinux.sh BUILD_WITH_TAG
10011071
- func: "upload release"
10021072

1073+
- name: "release-combine"
1074+
tags: ["release_tag"]
1075+
run_on: ubuntu2004-small
1076+
depends_on:
1077+
- name: "*"
1078+
variant: ".release_tag"
1079+
patch_optional: true
1080+
commands:
1081+
- func: "download and merge releases"
1082+
10031083
# Standard test tasks {{{
10041084

10051085
- name: "mockupdb"
@@ -2530,19 +2610,12 @@ buildvariants:
25302610
tasks:
25312611
- name: "load-balancer-test"
25322612

2533-
- matrix_name: "Release"
2534-
matrix_spec:
2535-
platform: [ubuntu-20.04, windows-64-vsMulti-small, macos-1014]
2536-
display_name: "Release ${platform}"
2613+
- name: Release
2614+
display_name: Release
25372615
batchtime: 20160 # 14 days
2616+
tags: ["release_tag"]
25382617
tasks:
2539-
- name: "release"
2540-
rules:
2541-
- if:
2542-
platform: ubuntu-20.04
2543-
then:
2544-
add_tasks:
2545-
- name: "release-old-manylinux"
2618+
- ".release_tag"
25462619

25472620
# Platform notes
25482621
# i386 builds of OpenSSL or Cyrus SASL are not available

RELEASE.rst

+13-24
Original file line numberDiff line numberDiff line change
@@ -55,48 +55,37 @@ Doing a Release
5555
8. Push commit / tag, eg ``git push && git push --tags``.
5656

5757
9. Pushing a tag will trigger a release process in Evergreen which builds
58-
wheels and eggs for manylinux, macOS, and Windows. Wait for these jobs to
59-
complete and then download the "Release files" archive from each task. See:
58+
wheels for manylinux, macOS, and Windows. Wait for the "release-combine"
59+
task to complete and then download the "Release files all" archive. See:
6060
https://evergreen.mongodb.com/waterfall/mongo-python-driver?bv_filter=release
6161

62-
Unpack each downloaded archive so that we can upload the included files. For
63-
the next steps let's assume we unpacked these files into the following paths::
62+
The contents should look like this::
6463

65-
$ ls path/to/manylinux
64+
$ ls path/to/archive
65+
pymongo-<version>-cp310-cp310-macosx_10_9_universal2.whl
66+
...
6667
pymongo-<version>-cp38-cp38-manylinux2014_x86_64.whl
6768
...
68-
$ ls path/to/windows/
6969
pymongo-<version>-cp38-cp38-win_amd64.whl
7070
...
71-
72-
10. Build the source distribution::
73-
74-
$ git clone git@github.com:mongodb/mongo-python-driver.git
75-
$ cd mongo-python-driver
76-
$ git checkout "<release version number>"
77-
$ python3 setup.py sdist
78-
79-
This will create the following distribution::
80-
81-
$ ls dist
8271
pymongo-<version>.tar.gz
8372

84-
11. Upload all the release packages to PyPI with twine::
73+
10. Upload all the release packages to PyPI with twine::
8574

86-
$ python3 -m twine upload dist/*.tar.gz path/to/manylinux/* path/to/mac/* path/to/windows/*
75+
$ python3 -m twine upload path/to/archive/*
8776

88-
12. Make sure the new version appears on https://pymongo.readthedocs.io/. If the
77+
11. Make sure the new version appears on https://pymongo.readthedocs.io/. If the
8978
new version does not show up automatically, trigger a rebuild of "latest":
9079
https://readthedocs.org/projects/pymongo/builds/
9180

92-
13. Bump the version number to <next version>.dev0 in setup.py/__init__.py,
81+
12. Bump the version number to <next version>.dev0 in setup.py/__init__.py,
9382
commit, push.
9483

95-
14. Publish the release version in Jira.
84+
13. Publish the release version in Jira.
9685

97-
15. Announce the release on:
86+
14. Announce the release on:
9887
https://developer.mongodb.com/community/forums/c/community/release-notes/
9988

100-
16. File a ticket for DOCSP highlighting changes in server version and Python
89+
15. File a ticket for DOCSP highlighting changes in server version and Python
10190
version compatibility or the lack thereof, for example:
10291
https://jira.mongodb.org/browse/DOCSP-13536

0 commit comments

Comments
 (0)