Skip to content

Commit 5c0705a

Browse files
committed
PYTHON-2434 Automatically combine release wheels + sdist into one archive (#803)
(cherry picked from commit 37b5195)
1 parent 31b2277 commit 5c0705a

File tree

2 files changed

+109
-52
lines changed

2 files changed

+109
-52
lines changed

.evergreen/config.yml

Lines changed: 96 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,16 @@ functions:
837837
# Remove all Docker images
838838
docker rmi -f $(docker images -a -q) &> /dev/null || true
839839
840+
"build release":
841+
- command: shell.exec
842+
type: test
843+
params:
844+
working_dir: "src"
845+
script: |
846+
set -o xtrace
847+
${PREPARE_SHELL}
848+
.evergreen/release.sh
849+
840850
"upload release":
841851
- command: archive.targz_pack
842852
params:
@@ -849,12 +859,63 @@ functions:
849859
aws_key: ${aws_key}
850860
aws_secret: ${aws_secret}
851861
local_file: release-files.tgz
852-
remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/release/${task_id}-${execution}-release-files.tar.gz
862+
remote_file: ${UPLOAD_BUCKET}/release/${revision}/${task_id}-${execution}-release-files.tar.gz
853863
bucket: mciuploads
854864
permissions: public-read
855865
content_type: ${content_type|application/gzip}
856866
display_name: Release files
857867

868+
"download and merge releases":
869+
- command: shell.exec
870+
params:
871+
silent: true
872+
script: |
873+
export AWS_ACCESS_KEY_ID=${aws_key}
874+
export AWS_SECRET_ACCESS_KEY=${aws_secret}
875+
876+
# Download all the task coverage files.
877+
aws s3 cp --recursive s3://mciuploads/${UPLOAD_BUCKET}/release/${revision}/ release/
878+
- command: shell.exec
879+
params:
880+
shell: "bash"
881+
script: |
882+
set -o xtrace
883+
${PREPARE_SHELL}
884+
# Combine releases into one directory.
885+
ls -la release/
886+
mkdir releases
887+
# Copy old manylinux release first since we want the newer manylinux
888+
# wheels to override them.
889+
mkdir old_manylinux
890+
if mv release/*old_manylinux* old_manylinux; then
891+
for REL in old_manylinux/*; do
892+
tar zxvf $REL -C releases/
893+
done
894+
fi
895+
for REL in release/*; do
896+
tar zxvf $REL -C releases/
897+
done
898+
# Build source distribution.
899+
cd src/
900+
/opt/python/3.6/bin/python3 setup.py sdist
901+
cp dist/* ../releases
902+
- command: archive.targz_pack
903+
params:
904+
target: "release-files-all.tgz"
905+
source_dir: "releases/"
906+
include:
907+
- "*"
908+
- command: s3.put
909+
params:
910+
aws_key: ${aws_key}
911+
aws_secret: ${aws_secret}
912+
local_file: release-files-all.tgz
913+
remote_file: ${UPLOAD_BUCKET}/release-all/${revision}/${task_id}-${execution}-release-files-all.tar.gz
914+
bucket: mciuploads
915+
permissions: public-read
916+
content_type: ${content_type|application/gzip}
917+
display_name: Release files all
918+
858919
pre:
859920
- func: "fetch source"
860921
- func: "prepare resources"
@@ -940,22 +1001,31 @@ tasks:
9401001
genhtml --version || true
9411002
valgrind --version || true
9421003
943-
- name: "release"
944-
tags: ["release"]
1004+
- name: "release-mac"
1005+
tags: ["release_tag"]
1006+
run_on: macos-1014
1007+
commands:
1008+
- func: "build release"
1009+
- func: "upload release"
1010+
1011+
- name: "release-windows"
1012+
tags: ["release_tag"]
1013+
run_on: windows-64-vsMulti-small
1014+
commands:
1015+
- func: "build release"
1016+
- func: "upload release"
1017+
1018+
- name: "release-manylinux"
1019+
tags: ["release_tag"]
1020+
run_on: ubuntu2004-large
9451021
exec_timeout_secs: 216000 # 60 minutes (manylinux task is slow).
9461022
commands:
947-
- command: shell.exec
948-
type: test
949-
params:
950-
working_dir: "src"
951-
script: |
952-
set -o xtrace
953-
${PREPARE_SHELL}
954-
.evergreen/release.sh
1023+
- func: "build release"
9551024
- func: "upload release"
9561025

9571026
- name: "release-old-manylinux"
958-
tags: ["release"]
1027+
tags: ["release_tag"]
1028+
run_on: ubuntu2004-large
9591029
exec_timeout_secs: 216000 # 60 minutes (manylinux task is slow).
9601030
commands:
9611031
- command: shell.exec
@@ -968,6 +1038,16 @@ tasks:
9681038
.evergreen/build-manylinux.sh BUILD_WITH_TAG
9691039
- func: "upload release"
9701040

1041+
- name: "release-combine"
1042+
tags: ["release_tag"]
1043+
run_on: ubuntu2004-small
1044+
depends_on:
1045+
- name: "*"
1046+
variant: ".release_tag"
1047+
patch_optional: true
1048+
commands:
1049+
- func: "download and merge releases"
1050+
9711051
# Standard test tasks {{{
9721052

9731053
- name: "mockupdb"
@@ -2899,19 +2979,12 @@ buildvariants:
28992979
tasks:
29002980
- name: "load-balancer-test"
29012981

2902-
- matrix_name: "Release"
2903-
matrix_spec:
2904-
platform: [ubuntu-20.04, windows-64-vsMulti-small, macos-1014]
2905-
display_name: "Release ${platform}"
2982+
- name: Release
2983+
display_name: Release
29062984
batchtime: 20160 # 14 days
2985+
tags: ["release_tag"]
29072986
tasks:
2908-
- name: "release"
2909-
rules:
2910-
- if:
2911-
platform: ubuntu-20.04
2912-
then:
2913-
add_tasks:
2914-
- name: "release-old-manylinux"
2987+
- ".release_tag"
29152988

29162989
# Platform notes
29172990
# i386 builds of OpenSSL or Cyrus SASL are not available

RELEASE.rst

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,54 +55,38 @@ 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
66-
pymongo-<version>-cp27-cp27m-manylinux1_i686.whl
64+
$ ls path/to/archive
65+
pymongo-<version>-cp310-cp310-macosx_10_9_universal2.whl
6766
...
6867
pymongo-<version>-cp38-cp38-manylinux2014_x86_64.whl
69-
$ ls path/to/mac/
7068
pymongo-<version>-cp27-cp27m-macosx_10_14_intel.whl
71-
...
7269
pymongo-<version>-py2.7-macosx-10.14-intel.egg
73-
$ ls path/to/windows/
74-
pymongo-<version>-cp27-cp27m-win32.whl
75-
...
7670
pymongo-<version>-cp38-cp38-win_amd64.whl
77-
78-
10. Build the source distribution::
79-
80-
$ git clone git@github.com:mongodb/mongo-python-driver.git
81-
$ cd mongo-python-driver
82-
$ git checkout "<release version number>"
83-
$ python3 setup.py sdist
84-
85-
This will create the following distribution::
86-
87-
$ ls dist
71+
...
8872
pymongo-<version>.tar.gz
8973

90-
11. Upload all the release packages to PyPI with twine::
74+
10. Upload all the release packages to PyPI with twine::
9175

92-
$ python3 -m twine upload dist/*.tar.gz path/to/manylinux/* path/to/mac/* path/to/windows/*
76+
$ python3 -m twine upload path/to/archive/*
9377

94-
12. Make sure the new version appears on https://pymongo.readthedocs.io/. If the
78+
11. Make sure the new version appears on https://pymongo.readthedocs.io/. If the
9579
new version does not show up automatically, trigger a rebuild of "latest":
9680
https://readthedocs.org/projects/pymongo/builds/
9781

98-
13. Bump the version number to <next version>.dev0 in setup.py/__init__.py,
82+
12. Bump the version number to <next version>.dev0 in setup.py/__init__.py,
9983
commit, push.
10084

101-
14. Publish the release version in Jira.
85+
13. Publish the release version in Jira.
10286

103-
15. Announce the release on:
87+
14. Announce the release on:
10488
https://developer.mongodb.com/community/forums/c/community/release-notes/
10589

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

0 commit comments

Comments
 (0)