3535 python3 -m pip install setuptools wheel twine
3636 python3 setup.py sdist
3737
38- - uses : actions/upload-artifact@v2
38+ - uses : actions/upload-artifact@v4
3939 with :
40- name : python-package-distributions
40+ name : python-package-distributions-sdist
4141 path : dist/*.tar.gz
4242
4343 build-wheels :
@@ -54,11 +54,33 @@ jobs:
5454 - name : Set up Python
5555 uses : actions/setup-python@v5
5656 with :
57- python-version : ' 3.9 '
57+ python-version : ' 3.11 '
5858 - name : Upgrade pip
5959 run : |
6060 python3 -m pip install --upgrade pip
6161
62+ - name : Pre-download virtualenv to avoid GitHub rate limits
63+ env :
64+ GH_TOKEN : ${{ github.token }}
65+ run : |
66+ VIRTUALENV_VERSION=20.21.1
67+ if [ "$RUNNER_OS" == "macOS" ]; then
68+ CACHE_DIR="$HOME/Library/Caches/cibuildwheel"
69+ else
70+ CACHE_DIR="$HOME/.cache/cibuildwheel"
71+ fi
72+ mkdir -p "$CACHE_DIR"
73+ DEST="$CACHE_DIR/virtualenv-${VIRTUALENV_VERSION}.pyz"
74+ if [ ! -f "$DEST" ]; then
75+ # Use GitHub API (authenticated, 5000 req/hr) instead of raw blob URL (unauthenticated, 60 req/hr)
76+ curl -sL --retry 5 --retry-delay 10 --retry-all-errors \
77+ -H "Authorization: token ${GH_TOKEN}" \
78+ -H "Accept: application/vnd.github.v3.raw" \
79+ -o "$DEST" \
80+ "https://api.github.com/repos/pypa/get-virtualenv/contents/public/virtualenv.pyz?ref=${VIRTUALENV_VERSION}"
81+ fi
82+ ls -la "$DEST"
83+
6284 - name : Install cibuildwheel
6385 run : |
6486 python3 -m pip install cibuildwheel==2.17.0
7395 CIBW_BEFORE_BUILD_LINUX : bash scripts/install-manylinux-deps.sh
7496 CIBW_BEFORE_BUILD_MACOS : bash scripts/install-macos-deps.sh
7597 CIBW_SKIP : " *-manylinux_i686 *musllinux*"
76- - uses : actions/upload-artifact@v2
98+ # Target macOS 14 (Sonoma) so wheels work on 14+.
99+ CIBW_ENVIRONMENT_MACOS : MACOSX_DEPLOYMENT_TARGET=14.0
100+ - uses : actions/upload-artifact@v4
77101 with :
78- name : python-package-distributions
102+ name : python-package-distributions-${{ matrix.os }}
79103 path : dist
80104
81105 publish-to-pypi :
@@ -84,13 +108,13 @@ jobs:
84108 - build-wheels
85109 - create-sdist
86110 steps :
87- - name : Download wheels from previous jobs
111+ - name : Download all artifacts
88112 # by default this will download all artifacts
89- uses : actions/download-artifact@v3
113+ uses : actions/download-artifact@v4
90114 with :
91- name : python-package-distributions
92115 # PyPI publish action uploads everything under dist/* by default
93116 path : dist
117+ merge-multiple : true
94118
95119 - name : Display the list of artifacts
96120 run : ls -R dist
0 commit comments