Avoid use of global variable. #2763
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Outstanding TODOs: | |
# - Auto PyPI upload? | |
# - Build sdist here too while we're at it? | |
# - Don't run this on every push ('on' param) | |
name: Build wheels | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
manylinux_wheels: | |
name: Python ${{ matrix.platform }} wheels(${{ matrix.pyver }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: | |
- manylinux_2_28_x86_64 | |
- manylinux_2_28_aarch64 | |
pyver: ['cp310-cp310', 'cp311-cp311', 'cp312-cp312'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up QEMU | |
if: matrix.platform == 'manylinux_2_28_aarch64' | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: Pull Docker image | |
run: | | |
DOCKER_IMAGE="quay.io/pypa/${{ matrix.platform }}" | |
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> $GITHUB_ENV | |
docker image pull "$DOCKER_IMAGE" | |
- name: Build manylinux wheels | |
run: | | |
docker container run \ | |
--rm \ | |
-e PLAT=${{ matrix.platform }} \ | |
-e PYTHON_TAGS=${{ matrix.pyver }} \ | |
-v "$(pwd):/io" \ | |
"$DOCKER_IMAGE" \ | |
/io/build_scripts/wheels/manylinux.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.platform }}-${{ matrix.pyver }} | |
path: dist/*.whl | |
macosx_wheels: | |
name: Python ${{ matrix.python_version }} MacOS wheels | |
# Note: the container MacOS version may differ from the SDK | |
# used to build Python there. It is the latter that determines | |
# the wheel's platform tag. | |
# https://github.com/actions/virtual-environments/issues/696 | |
runs-on: macos-13 | |
strategy: | |
matrix: | |
python_version: ['3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Build MacOS wheels | |
run: './build_scripts/wheels/macos.sh' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-macos-py${{ matrix.python_version }} | |
path: dist/*.whl | |
merge: | |
name: Merge artifacts | |
runs-on: ubuntu-latest | |
needs: | |
- manylinux_wheels | |
- macosx_wheels | |
steps: | |
- name: Merge artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: dist |