From 863c94e3dc825b7df81c03f9b79d612c57b2a45a Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 15 Oct 2023 22:04:51 +0200 Subject: [PATCH] :sparkles: Apple Silicon (arm64) support, fixes #36 Note that we (cross) compile for both arm64 and the universal2. This may feel redundant, it can still be interesting to have both. While universal2 is more convenient arm64 is lighter. Also drop Python 3.7 (end-of-life 2023-06-27). Add Python 3.12 and pypy-3.10 support. Bump CI actions versions as well. --- .github/workflows/build-and-deploy.yml | 17 +++++++++++------ .github/workflows/tests.yml | 13 ++++++++----- setup.py | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index f27f0b0..0bd3ccb 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -8,10 +8,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2019, macOS-11] + os: [ubuntu-22.04, windows-2022, macOS-11] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up QEMU if: runner.os == 'Linux' uses: docker/setup-qemu-action@v2 @@ -19,10 +19,15 @@ jobs: platforms: all # Used to host cibuildwheel - name: Build wheels - uses: pypa/cibuildwheel@v2.12.0 + uses: pypa/cibuildwheel@v2.16.2 env: # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: auto aarch64 ppc64le + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 + CIBW_TEST_REQUIRES: .[test] + CIBW_TEST_COMMAND: pytest {project} + # arm64 cannot be tested on a x86_64 CI runner + CIBW_TEST_SKIP: "*-macosx_arm64" - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl @@ -31,7 +36,7 @@ jobs: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build sdist run: pipx run build --sdist - uses: actions/upload-artifact@v3 @@ -44,13 +49,13 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 - uses: actions/download-artifact@v3 with: name: artifact path: dist - name: Publish package - uses: pypa/gh-action-pypi-publish@v1.5.0 + uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true user: __token__ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bbf4a1a..622cdfb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,16 +1,19 @@ name: Tests -on: [push] +on: [push, pull_request] + +env: + PYTHON_VERSIONS: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9", "pypy-3.10"] jobs: test: runs-on: ubuntu-22.04 strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy-3.7, pypy-3.8, pypy-3.9] + python: ${{fromJson(env.PYTHON_VERSIONS)}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} @@ -21,10 +24,10 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy-3.7, pypy-3.8, pypy-3.9] + python: ${{fromJson(env.PYTHON_VERSIONS)}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} diff --git a/setup.py b/setup.py index deca7df..99c090c 100644 --- a/setup.py +++ b/setup.py @@ -21,11 +21,11 @@ 'Operating System :: POSIX', 'Programming Language :: C', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Software Development :: Libraries :: Python Modules', ],