From 4d805a639e209bc20db8034f532649fb631ddbc9 Mon Sep 17 00:00:00 2001 From: Josh Levy-Kramer Date: Thu, 3 Oct 2024 10:26:50 +0100 Subject: [PATCH] Udate github actions --- .github/workflows/build_wheels.yml | 91 +++++++++++++++++++++++------- README.md | 10 ++-- README_dev.md | 2 + 3 files changed, 78 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 11d777d..572a803 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -1,4 +1,4 @@ -name: Build +name: Build & Test on: pull_request: @@ -10,35 +10,55 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true - +# Template from: https://github.com/pypa/cibuildwheel/blob/main/examples/github-with-qemu.yml jobs: build_wheels: name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }} runs-on: ${{ matrix.os }} strategy: + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + python: [cp310, cp311, cp312, cp313] matrix: - os: [ubuntu-20.04, macos-12, windows-2022] + # macos-13 is an intel runner, macos-14 is apple silicon + #os: [ubuntu-latest, macos-13, macos-14, windows-latest] python: [cp310, cp311, cp312, cp313] - arch: [x86_64, aarch64, AMD64, arm64] + os: [] # defined below + arch: [] + #arch: [x86_64, aarch64, AMD64, arm64] # Included archs: # Ubuntu: x86_64, aarch64 - # MacOS: x86_64, arm64 + # macos-13: x86_64, arm64 + # macos-13: arm64 # Windows: AMD64 - exclude: - - os: ubuntu-20.04 - arch: AMD64 - - os: ubuntu-20.04 - arch: arm64 - - os: macos-12 - arch: aarch64 - - os: macos-12 - arch: AMD64 - - os: windows-2022 - arch: x86_64 - - os: windows-2022 - arch: aarch64 - - os: windows-2022 - arch: arm64 + include: + - os: ubuntu-latest + arch: x86_64 + - os: ubuntu-latest + arch: aarch64 + - os: macos-13 + arch: x86_64 + - os: macos-14 + arch: arm64 + - os: windows-latest + arch: AMD64 + # exclude: + # - os: ubuntu-latest + # arch: AMD64 + # - os: ubuntu-latest + # arch: arm64 + # - os: macos-12 + # arch: aarch64 + # - os: macos-12 + # arch: AMD64 + # - os: windows-latest + # arch: x86_64 + # - os: windows-latest + # arch: aarch64 + # - os: windows-latest + # arch: arm64 fail-fast: false steps: @@ -58,4 +78,35 @@ jobs: CIBW_SKIP: "*musllinux*" - uses: actions/upload-artifact@v3 with: + path: ./wheelhouse/*.whl + + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.21.2 + env: + # configure cibuildwheel to build native archs ('auto'), and some + # emulated ones + CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/README.md b/README.md index cc4e8e6..e0ada6c 100644 --- a/README.md +++ b/README.md @@ -129,10 +129,10 @@ If you use this software in your research, please use the following citation: ``` @software{Levy-Kramer_k-means-constrained_2018, -author = {Levy-Kramer, Josh}, -month = apr, -title = {{k-means-constrained}}, -url = {https://github.com/joshlk/k-means-constrained}, -year = {2018} + author = {Levy-Kramer, Josh}, + month = apr, + title = {{k-means-constrained}}, + url = {https://github.com/joshlk/k-means-constrained}, + year = {2018} } ``` diff --git a/README_dev.md b/README_dev.md index 4782b1d..8c9d7cf 100644 --- a/README_dev.md +++ b/README_dev.md @@ -10,6 +10,8 @@ To test: pytest ``` +Push to GitHub to build for many version. The MacOS ARM build isn't automatically tested and so should be tested locally. + # Push to PyPi Requires: `pip install twine` Don't forget to increment version number