Skip to content

Commit

Permalink
[deploy] assert sufficient space is available at PyPI in deploy (#13118)
Browse files Browse the repository at this point in the history
  • Loading branch information
danking authored May 26, 2023
1 parent a79e34d commit 2b85ba5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hail/scripts/assert_pypi_has_room.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os

wheel_size = os.path.getsize(os.environ["WHEEL"])
pypi_used_storage = int(os.environ["PYPI_USED_STORAGE"])

print(f'Wheel size: {wheel_size / 1024 / 1024:.0f}MiB. PyPI used storage: {pypi_used_storage / 1024 / 1024:.0f}MiB.')

if wheel_size + pypi_used_storage > 10 * 1024 * 1024 * 1024:
print('Insufficient space available at PyPI.')
exit(1)
print('Sufficient space is available at PyPI.')
5 changes: 5 additions & 0 deletions hail/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -ex

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

retry() {
"$@" ||
(sleep 2 && "$@") ||
Expand Down Expand Up @@ -59,6 +61,9 @@ then
exit 1
fi

export PYPI_USED_STORAGE=$(curl https://pypi.org/pypi/hail/json | jq '[.releases[][].size ]| add')
python3 $SCRIPT_DIR/assert_pypi_has_room.py

# push git tag
git tag $HAIL_PIP_VERSION -m "Hail version $HAIL_PIP_VERSION."
git push origin $HAIL_PIP_VERSION
Expand Down

0 comments on commit 2b85ba5

Please sign in to comment.