From 8fc630a61eb976a6d97c4a0c7eb0d4f5e63e6b03 Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Thu, 30 Nov 2023 14:24:59 -0700 Subject: [PATCH] ci: Test macOS arm64 wheels on self-hosted runners --- .github/workflows/build.yml | 52 ++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 771ab765..f28f61a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,13 +65,10 @@ jobs: - { wheel: cp312-macosx_x86_64, os: macos-latest } - { wheel: cp312-manylinux_x86_64, os: ubuntu-latest } - { wheel: cp312-win_amd64, os: windows-latest } - - { wheel: pp39-manylinux_x86_64, os: ubuntu-latest } - # Currently broken with PyPy 7.3? See https://foss.heptapod.net/pypy/pypy/-/issues/4013. # - { wheel: pp39-macosx_x86_64, os: macos-latest } # - { wheel: pp39-win_amd64, os: windows-latest } - steps: - name: Download source distribution uses: actions/download-artifact@v3 @@ -92,9 +89,42 @@ jobs: CIBW_BUILD_VERBOSITY: 1 - uses: actions/upload-artifact@v3 with: - name: wheels + name: ${{ matrix.wheel }} path: ./wheelhouse/*.whl + test_macos_arm64_wheels: + needs: build_wheels + name: Test ${{ matrix.wheel }} macOS ARM64 wheel + runs-on: [macOS, ARM64] + strategy: + matrix: + include: + - { wheel: cp310-macosx_arm64, python: '3.10' } + - { wheel: cp311-macosx_arm64, python: '3.11' } + - { wheel: cp312-macosx_arm64, python: '3.12' } + # Not supported by setup-python for the self-hosted runner: + # Error: The version '3.9' with architecture 'arm64' was not found for macOS 13.6. + # - { wheel: cp38-macosx_arm64, python: '3.8' } + # - { wheel: cp39-macosx_arm64, python: '3.9' } + steps: + - run: rm -rf dist + - uses: actions/download-artifact@v3 + with: + name: source + path: dist + - uses: actions/download-artifact@v3 + with: + name: ${{ matrix.wheel }} + path: dist + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - run: | + pip install --force-reinstall ./dist/*.whl + tar xvf ./dist/pypcode-*.tar.gz + cd pypcode-*/tests + python -m unittest discover -v -s . + build_docs: name: Build docs runs-on: ubuntu-latest @@ -109,19 +139,17 @@ jobs: upload_pypi: name: Upload wheels to PyPI - needs: [lint, build_docs, build_sdist, build_wheels] + needs: [lint, build_docs, build_sdist, build_wheels, test_macos_arm64_wheels] runs-on: ubuntu-latest - # upload to PyPI on every tag starting with 'v' + # Upload to PyPI on every tag starting with 'v' if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') steps: - uses: actions/download-artifact@v3 with: - name: source - path: dist - - uses: actions/download-artifact@v3 - with: - name: wheels - path: dist + path: artifacts + - run: | + mkdir dist + find artifacts -type f -exec mv {} dist \; - uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__