From 09ef8febb0e53b51ffdb5da30ffcfe2b52979585 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 15:23:47 +0200 Subject: [PATCH 01/15] Add workflow based on @mzecc's work --- .github/workflows/build_wheels.yaml | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/build_wheels.yaml diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml new file mode 100644 index 0000000..de15e87 --- /dev/null +++ b/.github/workflows/build_wheels.yaml @@ -0,0 +1,31 @@ +name: Build + +on: [push, pull_request] + +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, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] + # os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v5 + + - name: Build wheels + uses: pypa/cibuildwheel@v3.1.4 + # env: + # CIBW_SOME_OPTION: value + # ... + with: + package-dir: . + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl From c65734c43d8517654f314fb461be4937d32181a3 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 15:29:51 +0200 Subject: [PATCH 02/15] Add fortran compiler install for mac builds --- .github/workflows/build_wheels.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index de15e87..fbfac2b 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -15,6 +15,16 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Install Fortran compiler + # When building from source, ensure we have a Fortran compiler + if: ${{ startsWith(matrix.os, 'macos') }} + uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + # TODO: figure out whether we need to use other compilers too + compiler: "gcc" + version: "13" + - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 # env: From 82f8a17348a9bfa19e8b19b1c048d3cfe65c5a0e Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 15:37:29 +0200 Subject: [PATCH 03/15] Try different gcc version for mac --- .github/workflows/build_wheels.yaml | 64 ++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index fbfac2b..35b172f 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -1,5 +1,9 @@ name: Build +# TODO: only run on published releases +# on: +# release: +# types: [published] on: [push, pull_request] jobs: @@ -7,6 +11,7 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] @@ -23,7 +28,7 @@ jobs: with: # TODO: figure out whether we need to use other compilers too compiler: "gcc" - version: "13" + version: "10" - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 @@ -38,4 +43,59 @@ jobs: - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl + path: wheelhouse/*.whl + + make_sdist: + name: Make source distribution + runs-on: "ubuntu-latest" + + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ./.github/actions/setup + with: + python-version: ${{ matrix.python-version }} + uv-dependency-install-flags: "--all-extras --group dev" + + - name: Create source distribution + run: uv build --sdist + + - name: Upload the source distribution artefact + uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + deploy-pypi: + needs: [build_wheels, make_sdist] + # Having an environment for deployment is strongly recommend by PyPI + # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions + # You can comment this line out if you don't want it. + environment: deploy + permissions: + # this permission is mandatory for trusted publishing with PyPI + id-token: write + runs-on: ubuntu-latest + steps: + - name: Download wheels + uses: actions/download-artifact@v5 + with: + pattern: cibw-* + path: wheelhouse + merge-multiple: true + - name: Download sdist + uses: actions/download-artifact@v5 + with: + pattern: cibw-* + path: dist + merge-multiple: true + - name: Diagnose where things are + run: | + ls dist + ls wheelhouse + # - name: Publish to PyPI + # run: | + # uv publish From c56cd6a2f3c554d90cf4d201e2042c7d7db683fe Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 15:45:31 +0200 Subject: [PATCH 04/15] Run on ubuntu only --- .github/workflows/build_wheels.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index 35b172f..fc05873 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -14,7 +14,8 @@ jobs: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] + # os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] + os: [ubuntu-latest, ubuntu-24.04-arm] # os: [ubuntu-latest] steps: From 6aa164cb584fb3fc4936583721e113d51997fa67 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 15:49:47 +0200 Subject: [PATCH 05/15] Turn off unnecessary permissions for testing --- .github/workflows/build_wheels.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index fc05873..9e1c5c9 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -4,7 +4,7 @@ name: Build # on: # release: # types: [published] -on: [push, pull_request] +on: [pull_request] jobs: build_wheels: @@ -75,10 +75,11 @@ jobs: # Having an environment for deployment is strongly recommend by PyPI # https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions # You can comment this line out if you don't want it. - environment: deploy - permissions: - # this permission is mandatory for trusted publishing with PyPI - id-token: write + # # TODO: turn back on when we only run this on main + # environment: deploy + # permissions: + # # this permission is mandatory for trusted publishing with PyPI + # id-token: write runs-on: ubuntu-latest steps: - name: Download wheels From df1ca5d144a137f961fe18cb952ad0f95c82cf2f Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 15:53:08 +0200 Subject: [PATCH 06/15] Remove unneded duplicate dist jobs --- .github/workflows/build_wheels.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index 9e1c5c9..b181e1e 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -82,20 +82,14 @@ jobs: # id-token: write runs-on: ubuntu-latest steps: - - name: Download wheels + - name: Download artefacts uses: actions/download-artifact@v5 with: pattern: cibw-* - path: wheelhouse - merge-multiple: true - - name: Download sdist - uses: actions/download-artifact@v5 - with: - pattern: cibw-* - path: dist merge-multiple: true - name: Diagnose where things are run: | + ls ls dist ls wheelhouse # - name: Publish to PyPI From edd079fbef1fd2bc9477243f9463d47f54389902 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:01:47 +0200 Subject: [PATCH 07/15] Try building on Mac again --- .github/workflows/build_wheels.yaml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index b181e1e..a79c9fb 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -15,8 +15,7 @@ jobs: matrix: # macos-13 is an intel runner, macos-14 is apple silicon # os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] - os: [ubuntu-latest, ubuntu-24.04-arm] - # os: [ubuntu-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14] steps: - uses: actions/checkout@v5 @@ -31,6 +30,16 @@ jobs: compiler: "gcc" version: "10" + - name: Set macOS-13 specific flags + if: matrix.os == 'macos-13' + run: | + echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> "$GITHUB_ENV" + + - name: Set macOS-14 specific flags + if: matrix.os == 'macos-14' + run: | + echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV" + - name: Build wheels uses: pypa/cibuildwheel@v3.1.4 # env: @@ -86,12 +95,9 @@ jobs: uses: actions/download-artifact@v5 with: pattern: cibw-* + path: dist merge-multiple: true - - name: Diagnose where things are - run: | - ls - ls dist - ls wheelhouse # - name: Publish to PyPI # run: | + # ls dist # uv publish From 557b9cf9165df98f46a2146bfd53aedbd03abf43 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:08:16 +0200 Subject: [PATCH 08/15] Use newer gcc version on mac builds --- .github/workflows/build_wheels.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index a79c9fb..c75e21a 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -26,9 +26,9 @@ jobs: uses: fortran-lang/setup-fortran@v1 id: setup-fortran with: - # TODO: figure out whether we need to use other compilers too + # TODO: figure out whether we need/want to use other compilers too compiler: "gcc" - version: "10" + version: "13" - name: Set macOS-13 specific flags if: matrix.os == 'macos-13' From 9558bd14c592c01f9b067599a56121328fee8a3c Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:21:07 +0200 Subject: [PATCH 09/15] Try adding python installation to see if windows is happier --- .github/workflows/build_wheels.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index c75e21a..dc5eb08 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -20,6 +20,12 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Setup Python + if: ${{ startsWith(matrix.os, 'windows') }} + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install Fortran compiler # When building from source, ensure we have a Fortran compiler if: ${{ startsWith(matrix.os, 'macos') }} @@ -97,7 +103,7 @@ jobs: pattern: cibw-* path: dist merge-multiple: true - # - name: Publish to PyPI - # run: | - # ls dist - # uv publish + - name: Publish to PyPI + run: | + ls dist + # uv publish From 258599188bca2d7342933aac1579726044f4d7ca Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:21:44 +0200 Subject: [PATCH 10/15] Turn on windows build --- .github/workflows/build_wheels.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index dc5eb08..8c4dbe4 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -14,8 +14,8 @@ jobs: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon - # os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] - os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] + # os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14] steps: - uses: actions/checkout@v5 From e08ca5b95bd8dd552a081c25a9a50ac85d99df5a Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:40:45 +0200 Subject: [PATCH 11/15] Try using a windows developer shell --- .github/workflows/build_wheels.yaml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index 8c4dbe4..674af13 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -14,8 +14,20 @@ jobs: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14] - # os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14] + os: [ + ubuntu-latest, + ubuntu-24.04-arm, + windows-2022, + # # windows-latest is moving target at the moment + # windows-latest, + # # Seems to be experimental, leave out for now + # # https://cibuildwheel.pypa.io/en/stable/#usage + # windows-11-arm, + # Maybe something crazy required, + # see numpy's fun https://github.com/numpy/numpy/blob/main/.github/windows_arm64_steps/action.yml + macos-13, + macos-14, + ] steps: - uses: actions/checkout@v5 @@ -26,6 +38,13 @@ jobs: with: python-version: '3.11' + # Maybe not necessary, source: + # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ + - name: Prepare MSVC + uses: bus1/cabuild/action/msdevshell@v1 + with: + architecture: x64 + - name: Install Fortran compiler # When building from source, ensure we have a Fortran compiler if: ${{ startsWith(matrix.os, 'macos') }} From a9b089d0c1659d798c76bec45a583ffec84a48f3 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:44:38 +0200 Subject: [PATCH 12/15] Last try before end of day --- .github/workflows/build_wheels.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index 674af13..21e64ba 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -32,15 +32,18 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Setup Python - if: ${{ startsWith(matrix.os, 'windows') }} - uses: actions/setup-python@v5 - with: - python-version: '3.11' + # - name: Setup Python + # if: ${{ startsWith(matrix.os, 'windows') }} + # uses: actions/setup-python@v5 + # with: + # python-version: '3.11' # Maybe not necessary, source: # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ - - name: Prepare MSVC + # and + # https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L123 + - name: Setup MSVC developer shell (32-bit) + if: ${{ matrix.os == 'windows-2022' }} uses: bus1/cabuild/action/msdevshell@v1 with: architecture: x64 From cfc2b0d4a8a204f6f0ab509e43059a4096b3fa46 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:48:10 +0200 Subject: [PATCH 13/15] Turn python setup back on --- .github/workflows/build_wheels.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index 21e64ba..c419785 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -32,11 +32,11 @@ jobs: steps: - uses: actions/checkout@v5 - # - name: Setup Python - # if: ${{ startsWith(matrix.os, 'windows') }} - # uses: actions/setup-python@v5 - # with: - # python-version: '3.11' + - name: Setup Python + if: ${{ startsWith(matrix.os, 'windows') }} + uses: actions/setup-python@v5 + with: + python-version: '3.x' # Maybe not necessary, source: # https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/ From 39bc70deb2c6b7dd02402d02ff03db24e5e01f1c Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 16:51:28 +0200 Subject: [PATCH 14/15] Last set of notes --- .github/workflows/build_wheels.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index c419785..f11a72c 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -17,6 +17,9 @@ jobs: os: [ ubuntu-latest, ubuntu-24.04-arm, + # Failing, probably need to: + # - read https://github.com/mesonbuild/meson-python/issues/222 + # - maybe try with https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L133 windows-2022, # # windows-latest is moving target at the moment # windows-latest, From 8e5ee2114b6a339c8a6bc00bef2f127621cacbe8 Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Fri, 22 Aug 2025 17:01:27 +0200 Subject: [PATCH 15/15] More notes --- .github/workflows/build_wheels.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yaml b/.github/workflows/build_wheels.yaml index f11a72c..2014a4f 100644 --- a/.github/workflows/build_wheels.yaml +++ b/.github/workflows/build_wheels.yaml @@ -20,11 +20,12 @@ jobs: # Failing, probably need to: # - read https://github.com/mesonbuild/meson-python/issues/222 # - maybe try with https://github.com/numpy/numpy/blob/71eebaf8513dfd6ed40b0c689702d81e3f6f2527/.github/workflows/wheels.yml#L133 + # - maybe try with https://github.com/matplotlib/matplotlib/blob/5054100eaf8b49cfd8d42cac9c224f9f5dd92508/.github/workflows/cibuildwheel.yml#L81 windows-2022, # # windows-latest is moving target at the moment # windows-latest, - # # Seems to be experimental, leave out for now - # # https://cibuildwheel.pypa.io/en/stable/#usage + # To make this work, likely need some more trickery, see: + # - https://github.com/matplotlib/matplotlib/blob/5054100eaf8b49cfd8d42cac9c224f9f5dd92508/pyproject.toml#L89 # windows-11-arm, # Maybe something crazy required, # see numpy's fun https://github.com/numpy/numpy/blob/main/.github/windows_arm64_steps/action.yml