From 0f92e41a0005e72578e620ffe6128ad03094d491 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Thu, 23 May 2024 10:51:47 -0400 Subject: [PATCH] Modernize cibuildwheel configuration. Build and test macos-arm64 packages natively. --- .github/workflows/build_wheels.yaml | 30 +++++++++++++++++++---------- .github/workflows/release.yaml | 3 +++ pyproject.toml | 10 +--------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index 78a2e363..fb256b27 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -20,16 +20,26 @@ env: jobs: build_wheels: - name: Build wheels [py${{ matrix.python_version }}, ${{ matrix.os }}] - runs-on: ${{ matrix.os }}-${{ matrix.os_version }} + name: Build wheels [${{ matrix.python }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}] + runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }} strategy: fail-fast: false matrix: - os: [ubuntu, windows, macos] - python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - - include: - - os_version: 'latest' + os: + - base: ubuntu + version: latest + arch: 'x86_64' + - base: windows + version: latest + arch: 'amd64' + - base: macos + version: 14 + arch: 'arm64' + - base: macos + version: 13 + arch: 'x86_64' + + python: ['cp38', 'cp39', 'cp310', 'cp311', 'cp312'] steps: - uses: actions/checkout@v4.1.6 @@ -37,18 +47,18 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.18.1 env: - CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.python_version }}.*" + CIBW_BUILD: "${{ matrix.python }}-*" - uses: actions/upload-artifact@v4.3.3 with: - name: dist-python-${{ matrix.python_version }}-${{ matrix.os }} + name: dist-python-${{ matrix.python }}-${{ matrix.os.base }}-${{ matrix.os.arch }} path: ./wheelhouse/*.whl build_sdist: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.4 + - uses: actions/checkout@v4.1.6 - uses: actions/setup-python@v5.1.0 name: Install Python diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7de097e1..a4b8a28f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -37,6 +37,9 @@ jobs: submodules: true path: code + - name: Install tools + run: sudo apt install pcregrep pandoc + - name: Determine last tag via git describe if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} run: echo tag="$(git describe --abbrev=0)" >> "$GITHUB_ENV" diff --git a/pyproject.toml b/pyproject.toml index 4f15af4f..74f1a3b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,21 +39,13 @@ requires = ["setuptools>=64.0.0", "oldest-supported-numpy"] [tool.cibuildwheel] -# Build for cpython only -skip = "pp*" - # Test the wheels. test-command = "pytest --pyargs gsd -v --log-level=DEBUG" -test-skip = "*-macosx_arm64" test-requires = "pytest" -# Build only on 64-bit architectures. +# Build on 64-bit architectures. archs = ["auto64"] -[tool.cibuildwheel.macos] -# Build for x86_64 and arm64 -archs = ["x86_64", "arm64"] - [tool.cibuildwheel.linux] # dependencies do not build for musl skip = ["pp* *musllinux*"]