From 42b6e5edf541dd397c62de9d439ea81b810874d2 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Fri, 19 Dec 2025 08:42:28 -0300 Subject: [PATCH 1/4] Generate workflow to upload package to PyPI --- .github/workflows/maturin_upload_pypi.yml | 181 ++++++++++++++++++++++ .gitignore | 4 +- 2 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/maturin_upload_pypi.yml diff --git a/.github/workflows/maturin_upload_pypi.yml b/.github/workflows/maturin_upload_pypi.yml new file mode 100644 index 0000000..a63ff59 --- /dev/null +++ b/.github/workflows/maturin_upload_pypi.yml @@ -0,0 +1,181 @@ +# This file is autogenerated by maturin v1.10.2 +# To update, run +# +# maturin generate-ci github +# +name: CI + +on: + push: + branches: + - main + - master + tags: + - '*' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: x86 + - runner: ubuntu-22.04 + target: aarch64 + - runner: ubuntu-22.04 + target: armv7 + - runner: ubuntu-22.04 + target: s390x + - runner: ubuntu-22.04 + target: ppc64le + steps: + - uses: actions/checkout@v4 + - 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/') }} + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + + musllinux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-22.04 + target: x86_64 + - runner: ubuntu-22.04 + target: x86 + - runner: ubuntu-22.04 + target: aarch64 + - runner: ubuntu-22.04 + target: armv7 + steps: + - uses: actions/checkout@v4 + - 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/') }} + manylinux: musllinux_1_2 + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-musllinux-${{ matrix.platform.target }} + path: dist + + windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + - runner: windows-latest + target: x86 + steps: + - uses: actions/checkout@v4 + - 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@v4 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist + + macos: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: macos-13 + target: x86_64 + - runner: macos-14 + target: aarch64 + steps: + - uses: actions/checkout@v4 + - 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@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + needs: [linux, musllinux, windows, macos, sdist] + permissions: + # Use to sign the release artifacts + id-token: write + # Used to upload release artifacts + contents: write + # Used to generate artifact attestation + attestations: write + steps: + - uses: actions/download-artifact@v4 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-path: 'wheels-*/*' + - name: Publish to PyPI + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing wheels-*/* diff --git a/.gitignore b/.gitignore index deddfdd..5201dd9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ .idea # Ignore Pytest artifacts -/tests/__pycache__ \ No newline at end of file +/tests/__pycache__ + +.vscode/ From 4750a1e3bc9174173449ec956b5a489b50e2b6b9 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Fri, 19 Dec 2025 08:55:13 -0300 Subject: [PATCH 2/4] Update file --- .github/workflows/maturin_upload_pypi.yml | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/maturin_upload_pypi.yml b/.github/workflows/maturin_upload_pypi.yml index a63ff59..0a1132e 100644 --- a/.github/workflows/maturin_upload_pypi.yml +++ b/.github/workflows/maturin_upload_pypi.yml @@ -37,8 +37,8 @@ jobs: - runner: ubuntu-22.04 target: ppc64le steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@main + - uses: actions/setup-python@main with: python-version: 3.x - name: Build wheels @@ -49,7 +49,7 @@ jobs: sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} manylinux: auto - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: wheels-linux-${{ matrix.platform.target }} path: dist @@ -68,8 +68,8 @@ jobs: - runner: ubuntu-22.04 target: armv7 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@main + - uses: actions/setup-python@main with: python-version: 3.x - name: Build wheels @@ -80,7 +80,7 @@ jobs: sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} manylinux: musllinux_1_2 - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: wheels-musllinux-${{ matrix.platform.target }} path: dist @@ -95,8 +95,8 @@ jobs: - runner: windows-latest target: x86 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@main + - uses: actions/setup-python@main with: python-version: 3.x architecture: ${{ matrix.platform.target }} @@ -107,7 +107,7 @@ jobs: args: --release --out dist --find-interpreter sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: wheels-windows-${{ matrix.platform.target }} path: dist @@ -122,8 +122,8 @@ jobs: - runner: macos-14 target: aarch64 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@main + - uses: actions/setup-python@main with: python-version: 3.x - name: Build wheels @@ -133,7 +133,7 @@ jobs: args: --release --out dist --find-interpreter sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: wheels-macos-${{ matrix.platform.target }} path: dist @@ -141,14 +141,14 @@ jobs: sdist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@main - name: Build sdist uses: PyO3/maturin-action@v1 with: command: sdist args: --out dist - name: Upload sdist - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@main with: name: wheels-sdist path: dist @@ -166,9 +166,9 @@ jobs: # Used to generate artifact attestation attestations: write steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@main - name: Generate artifact attestation - uses: actions/attest-build-provenance@v2 + uses: actions/attest-build-provenance@main with: subject-path: 'wheels-*/*' - name: Publish to PyPI From 029332d69b8a3010466bf51c3d5dc0cd7bfe5b46 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Fri, 19 Dec 2025 08:57:38 -0300 Subject: [PATCH 3/4] always run --- .github/workflows/maturin_upload_pypi.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/maturin_upload_pypi.yml b/.github/workflows/maturin_upload_pypi.yml index 0a1132e..8b42c5c 100644 --- a/.github/workflows/maturin_upload_pypi.yml +++ b/.github/workflows/maturin_upload_pypi.yml @@ -7,11 +7,6 @@ name: CI on: push: - branches: - - main - - master - tags: - - '*' pull_request: workflow_dispatch: From 0c81f1b1e74a3e901d567e487e0a31cfc1fec3fd Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Fri, 19 Dec 2025 09:01:12 -0300 Subject: [PATCH 4/4] Fix macos x86 build --- .github/workflows/maturin_upload_pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maturin_upload_pypi.yml b/.github/workflows/maturin_upload_pypi.yml index 8b42c5c..71e68e1 100644 --- a/.github/workflows/maturin_upload_pypi.yml +++ b/.github/workflows/maturin_upload_pypi.yml @@ -3,7 +3,7 @@ # # maturin generate-ci github # -name: CI +name: Build and upload to PyPI on: push: @@ -112,7 +112,7 @@ jobs: strategy: matrix: platform: - - runner: macos-13 + - runner: macos-15-intel target: x86_64 - runner: macos-14 target: aarch64