From 7f3e183d22ab798a6fe8daa170f90921539b0a31 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 31 Jan 2024 21:28:08 -0600 Subject: [PATCH 1/2] PYTHON-4177 Build and Test M1 macOS wheels on GHA --- .github/workflows/release-python.yml | 32 ++++++++++++++++++---------- pyproject.toml | 5 ----- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 4c6b082057..0522febb84 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -8,6 +8,7 @@ on: - "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" workflow_dispatch: + pull_request: concurrency: group: wheels-${{ github.ref }} @@ -33,10 +34,22 @@ jobs: - [ubuntu-20.04, manylinux_ppc64le] - [ubuntu-20.04, manylinux_s390x] - [ubuntu-20.04, manylinux_i686] - - [macos-11, macosx_*] - [windows-2019, win_amd64] - [windows-2019, win32] python: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"] + include: + - buildplat: [macos-11, macosx_x86_64] + python: "cp37" + - buildplat: [macos-11, macosx_*] + python: "cp38" + - buildplat: [macos-11, macosx_*] + python: "cp39" + - buildplat: [macos-14, macosx_*] + python: "cp310" + - buildplat: [macos-14, macosx_*] + python: "cp311" + - buildplat: [macos-14, macosx_*] + python: "cp312" steps: - name: Checkout pymongo @@ -66,25 +79,22 @@ jobs: # Note: the default manylinux is manylinux2014 run: python -m pip install "cibuildwheel>=2.4,<3" - - name: Build MacOS Py37 Wheel - # Universal wheels are not supported with Python 3.7, so we explicitly - # produce an x86_64 wheel for Python 3.7 on MacOS. - if: ${{ matrix.python == 'cp37' && matrix.buildplat[0] == 'macos-11' }} + - name: Build wheel + if: ${{ matrix.buildplat[0] != 'macos-14' }} env: - CIBW_BUILD: cp37-macosx_x86_64 - CIBW_ARCHS: x86_64 - CIBW_TEST_COMMAND: "python {project}/tools/fail_if_no_c.py" + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} + MACOS_TEST_SKIP: "*arm64" run: python -m cibuildwheel --output-dir wheelhouse - - name: Build wheel - if: ${{ matrix.python != 'cp37' || matrix.buildplat[0] != 'macos-11' }} + - name: Build wheel on M1 + if: ${{ matrix.buildplat[0] == 'macos-14' }} env: CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} run: python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v3 with: - name: wheel-${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} + name: wheel-${{ matrix.python }}-${{ matrix.buildplat[1] }} path: ./wheelhouse/*.whl if-no-files-found: error diff --git a/pyproject.toml b/pyproject.toml index b182a16f7c..481c651e40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -235,8 +235,3 @@ test-command = "python {project}/tools/fail_if_no_c.py" [tool.cibuildwheel.linux] archs = "x86_64 aarch64 ppc64le s390x i686" - -[tool.cibuildwheel.macos] -archs = "universal2" -test-command = "ENSURE_UNIVERSAL2=1 python {project}/tools/fail_if_no_c.py" -test-skip = "*-macosx_universal2:arm64" From 4cbaf211f24a6ee8f9222049e80ec0e04fea1dd0 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 1 Feb 2024 05:31:41 -0600 Subject: [PATCH 2/2] fix upload artifact --- .github/workflows/release-python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 0522febb84..907b0d22af 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -94,7 +94,7 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: wheel-${{ matrix.python }}-${{ matrix.buildplat[1] }} + name: wheel-${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }} path: ./wheelhouse/*.whl if-no-files-found: error