From 798a98aa29ccd77cbfda53577b6b34c73a181213 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Mon, 24 Nov 2025 14:50:15 +0100 Subject: [PATCH 1/6] Use only the wheel files when creating a release Signed-off-by: Sahas Subramanian --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 640b505..2aac710 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -325,7 +325,7 @@ jobs: --generate-notes \ $extra_opts \ $REF_NAME \ - dist/dist-packages-*/* + dist/dist-packages-*/*.whl env: REF_NAME: ${{ github.ref_name }} REPOSITORY: ${{ github.repository }} From 61550eae361fea46f315210681484e4ec824ad83 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Mon, 24 Nov 2025 15:26:07 +0100 Subject: [PATCH 2/6] Build a source distribution package Signed-off-by: Sahas Subramanian --- .github/workflows/ci.yaml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2aac710..f66b918 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -112,9 +112,25 @@ jobs: path: dist/ if-no-files-found: error + build-sdist: + name: Build source distribution packages + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v5 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: dist-packages-sdist + path: dist + test-installation: name: Test package installation - needs: ["build"] + needs: ["build", "build-sdist"] strategy: fail-fast: false matrix: @@ -325,7 +341,7 @@ jobs: --generate-notes \ $extra_opts \ $REF_NAME \ - dist/dist-packages-*/*.whl + dist/dist-packages-*/*.whl dist/dist-packages-sdist/*.tar.gz env: REF_NAME: ${{ github.ref_name }} REPOSITORY: ${{ github.repository }} From 4deccf6617cd3d6c7882db4b2206ab9e901a5f80 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Mon, 24 Nov 2025 18:14:46 +0100 Subject: [PATCH 3/6] Avoid duplicate sdist files so they can be merged without conflict Signed-off-by: Sahas Subramanian --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f66b918..3a9d8a8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -109,7 +109,7 @@ jobs: uses: actions/upload-artifact@v5 with: name: dist-packages-${{ matrix.target }}-${{ matrix.python }} - path: dist/ + path: dist/*.whl if-no-files-found: error build-sdist: @@ -126,7 +126,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: dist-packages-sdist - path: dist + path: dist/*.tar.gz test-installation: name: Test package installation @@ -360,6 +360,7 @@ jobs: uses: actions/download-artifact@v6 with: path: dist + merge-multiple: true - name: Publish the Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 From 5cdae373407e580f4be702f437194e167e3a3ecb Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Mon, 24 Nov 2025 20:37:25 +0100 Subject: [PATCH 4/6] Switch to maturin-action, to get manylinux builds Signed-off-by: Sahas Subramanian --- .github/workflows/ci.yaml | 164 ++++++++++++++++++++++++++++---------- 1 file changed, 121 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3a9d8a8..3b151af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,47 +70,110 @@ jobs: - name: Check matrix job result run: test "$DEPS_RESULT" = "success" - build: - name: Build distribution packages + build-linux: + runs-on: ${{ matrix.platform.runner }} strategy: - fail-fast: false matrix: - target: - - ubuntu-24.04 - - ubuntu-24.04-arm - - windows-latest - - macos-15-intel - - macos-15 - python: - - "3.11" - - "3.12" - - "3.13" - - "3.14" - runs-on: ${{ matrix.target }} + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: aarch64 steps: - - name: Setup Git - uses: frequenz-floss/gh-action-setup-git@v1.0.0 - - - name: Fetch sources - uses: actions/checkout@v5 + - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 with: - submodules: true + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v5 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist - - name: Setup Python - uses: frequenz-floss/gh-action-setup-python-with-deps@v1.0.1 + build-musllinux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: aarch64 + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python }} - dependencies: build + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + manylinux: musllinux_1_2 + - name: Upload wheels + uses: actions/upload-artifact@v5 + with: + name: wheels-musllinux-${{ matrix.platform.target }} + path: dist - - name: Build the source and binary distribution - run: python -m build + build-windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + architecture: ${{ matrix.platform.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + - name: Upload wheels + uses: actions/upload-artifact@v5 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist - - name: Upload distribution files + build-macos: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: macos-15-intel + target: x86_64 + - runner: macos-15 + target: aarch64 + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} + - name: Upload wheels uses: actions/upload-artifact@v5 with: - name: dist-packages-${{ matrix.target }}-${{ matrix.python }} - path: dist/*.whl - if-no-files-found: error + name: wheels-macos-${{ matrix.platform.target }} + path: dist build-sdist: name: Build source distribution packages @@ -123,29 +186,44 @@ jobs: command: sdist args: --out dist - name: Upload sdist - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: - name: dist-packages-sdist + name: wheels-sdist path: dist/*.tar.gz test-installation: name: Test package installation - needs: ["build", "build-sdist"] + needs: + - "build-linux" + - "build-musllinux" + - "build-windows" + - "build-macos" + - "build-sdist" strategy: fail-fast: false matrix: - target: - - ubuntu-24.04 - - ubuntu-24.04-arm - - windows-latest - - macos-15-intel - - macos-15 + platform: + - runner: ubuntu-24.04 + image: linux + target: x86_64 + - runner: ubuntu-24.04-arm + image: linux + target: aarch64 + - runner: windows-latest + image: windows + target: x64 + - runner: macos-15-intel + image: macos + target: x86_64 + - runner: macos-15 + image: macos + target: aarch64 python: - "3.11" - "3.12" - "3.13" - "3.14" - runs-on: ${{ matrix.target }} + runs-on: ${{ matrix.platform.runner }} steps: - name: Setup Git @@ -157,7 +235,7 @@ jobs: - name: Download package uses: actions/download-artifact@v6 with: - name: dist-packages-${{ matrix.target }}-${{ matrix.python }} + name: wheels-${{ matrix.platform.image }}-${{ matrix.platform.target }} path: dist # This is necessary for the `pip` caching in the setup-python action to work @@ -341,7 +419,7 @@ jobs: --generate-notes \ $extra_opts \ $REF_NAME \ - dist/dist-packages-*/*.whl dist/dist-packages-sdist/*.tar.gz + dist/wheels-*/*.whl dist/wheels-sdist/*.tar.gz env: REF_NAME: ${{ github.ref_name }} REPOSITORY: ${{ github.repository }} From 955616bc22162a3f3dfe08a3361b027b7cfa7878 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Mon, 24 Nov 2025 20:57:14 +0100 Subject: [PATCH 5/6] Extend matrix to filter for wheel corresponding to python version Signed-off-by: Sahas Subramanian --- .github/workflows/ci.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3b151af..569a15e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -219,10 +219,14 @@ jobs: image: macos target: aarch64 python: - - "3.11" - - "3.12" - - "3.13" - - "3.14" + - semver: "3.11" + wheelver: cp311 + - semver: "3.12" + wheelver: cp312 + - semver: "3.13" + wheelver: cp313 + - semver: "3.14" + wheelver: cp314 runs-on: ${{ matrix.platform.runner }} steps: @@ -256,8 +260,8 @@ jobs: - name: Setup Python uses: frequenz-floss/gh-action-setup-python-with-deps@v1.0.1 with: - python-version: ${{ matrix.python }} - dependencies: dist/*.whl + python-version: ${{ matrix.python.semver }} + dependencies: dist/*${{ matrix.python.wheelver }}*.whl - name: Print installed packages (debug) run: python -m pip freeze From 6049e8396ca4a234769c43ee2ac2fdbb7a708f70 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Mon, 24 Nov 2025 21:19:21 +0100 Subject: [PATCH 6/6] Ensure the free-threading builds don't get picked up Signed-off-by: Sahas Subramanian --- .github/workflows/ci.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 569a15e..f0bbfb1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -205,18 +205,23 @@ jobs: platform: - runner: ubuntu-24.04 image: linux + tag: manylinux target: x86_64 - runner: ubuntu-24.04-arm image: linux + tag: manylinux target: aarch64 - runner: windows-latest image: windows + tag: win target: x64 - runner: macos-15-intel image: macos + tag: macosx target: x86_64 - runner: macos-15 image: macos + tag: macosx target: aarch64 python: - semver: "3.11" @@ -261,7 +266,7 @@ jobs: uses: frequenz-floss/gh-action-setup-python-with-deps@v1.0.1 with: python-version: ${{ matrix.python.semver }} - dependencies: dist/*${{ matrix.python.wheelver }}*.whl + dependencies: dist/*${{ matrix.python.wheelver }}-${{ matrix.platform.tag }}*.whl - name: Print installed packages (debug) run: python -m pip freeze