|
| 1 | +# This file is autogenerated by maturin v1.12.6 |
| 2 | +# To update, run |
| 3 | +# |
| 4 | +# maturin generate-ci github --platform all |
| 5 | +# |
| 6 | +name: Publish PyPI |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + tags: |
| 11 | + - 'v*' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + linux: |
| 19 | + runs-on: ${{ matrix.platform.runner }} |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + platform: |
| 23 | + - runner: ubuntu-22.04 |
| 24 | + target: x86_64 |
| 25 | + - runner: ubuntu-22.04 |
| 26 | + target: x86 |
| 27 | + - runner: ubuntu-22.04 |
| 28 | + target: aarch64 |
| 29 | + - runner: ubuntu-22.04 |
| 30 | + target: armv7 |
| 31 | + - runner: ubuntu-22.04 |
| 32 | + target: s390x |
| 33 | + - runner: ubuntu-22.04 |
| 34 | + target: ppc64le |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v6 |
| 37 | + - uses: actions/setup-python@v6 |
| 38 | + with: |
| 39 | + python-version: 3.x |
| 40 | + - name: Build wheels |
| 41 | + uses: PyO3/maturin-action@v1 |
| 42 | + with: |
| 43 | + target: ${{ matrix.platform.target }} |
| 44 | + args: --release --out dist --find-interpreter |
| 45 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 46 | + manylinux: auto |
| 47 | + - name: Upload wheels |
| 48 | + uses: actions/upload-artifact@v6 |
| 49 | + with: |
| 50 | + name: wheels-linux-${{ matrix.platform.target }} |
| 51 | + path: dist |
| 52 | + |
| 53 | + musllinux: |
| 54 | + runs-on: ${{ matrix.platform.runner }} |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + platform: |
| 58 | + - runner: ubuntu-22.04 |
| 59 | + target: x86_64 |
| 60 | + - runner: ubuntu-22.04 |
| 61 | + target: x86 |
| 62 | + - runner: ubuntu-22.04 |
| 63 | + target: aarch64 |
| 64 | + - runner: ubuntu-22.04 |
| 65 | + target: armv7 |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v6 |
| 68 | + - uses: actions/setup-python@v6 |
| 69 | + with: |
| 70 | + python-version: 3.x |
| 71 | + - name: Build wheels |
| 72 | + uses: PyO3/maturin-action@v1 |
| 73 | + with: |
| 74 | + target: ${{ matrix.platform.target }} |
| 75 | + args: --release --out dist --find-interpreter |
| 76 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 77 | + manylinux: musllinux_1_2 |
| 78 | + - name: Upload wheels |
| 79 | + uses: actions/upload-artifact@v6 |
| 80 | + with: |
| 81 | + name: wheels-musllinux-${{ matrix.platform.target }} |
| 82 | + path: dist |
| 83 | + |
| 84 | + windows: |
| 85 | + runs-on: ${{ matrix.platform.runner }} |
| 86 | + strategy: |
| 87 | + matrix: |
| 88 | + platform: |
| 89 | + - runner: windows-latest |
| 90 | + target: x64 |
| 91 | + python_arch: x64 |
| 92 | + - runner: windows-latest |
| 93 | + target: x86 |
| 94 | + python_arch: x86 |
| 95 | + - runner: windows-11-arm |
| 96 | + target: aarch64 |
| 97 | + python_arch: arm64 |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v6 |
| 100 | + - uses: actions/setup-python@v6 |
| 101 | + with: |
| 102 | + python-version: 3.13 |
| 103 | + architecture: ${{ matrix.platform.python_arch }} |
| 104 | + - name: Build wheels |
| 105 | + uses: PyO3/maturin-action@v1 |
| 106 | + with: |
| 107 | + target: ${{ matrix.platform.target }} |
| 108 | + args: --release --out dist --find-interpreter |
| 109 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 110 | + - name: Upload wheels |
| 111 | + uses: actions/upload-artifact@v6 |
| 112 | + with: |
| 113 | + name: wheels-windows-${{ matrix.platform.target }} |
| 114 | + path: dist |
| 115 | + |
| 116 | + macos: |
| 117 | + runs-on: ${{ matrix.platform.runner }} |
| 118 | + strategy: |
| 119 | + matrix: |
| 120 | + platform: |
| 121 | + - runner: macos-15-intel |
| 122 | + target: x86_64 |
| 123 | + - runner: macos-latest |
| 124 | + target: aarch64 |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v6 |
| 127 | + - uses: actions/setup-python@v6 |
| 128 | + with: |
| 129 | + python-version: 3.x |
| 130 | + - name: Build wheels |
| 131 | + uses: PyO3/maturin-action@v1 |
| 132 | + with: |
| 133 | + target: ${{ matrix.platform.target }} |
| 134 | + args: --release --out dist --find-interpreter |
| 135 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 136 | + - name: Upload wheels |
| 137 | + uses: actions/upload-artifact@v6 |
| 138 | + with: |
| 139 | + name: wheels-macos-${{ matrix.platform.target }} |
| 140 | + path: dist |
| 141 | + |
| 142 | + emscripten: |
| 143 | + runs-on: ${{ matrix.platform.runner }} |
| 144 | + strategy: |
| 145 | + matrix: |
| 146 | + platform: |
| 147 | + - runner: ubuntu-22.04 |
| 148 | + target: wasm32-unknown-emscripten |
| 149 | + steps: |
| 150 | + - uses: actions/checkout@v6 |
| 151 | + - run: pip install pyodide-build |
| 152 | + - name: Get Emscripten and Python version info |
| 153 | + shell: bash |
| 154 | + run: | |
| 155 | + echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV |
| 156 | + echo PYTHON_VERSION=$(pyodide config get python_version | cut -d '.' -f 1-2) >> $GITHUB_ENV |
| 157 | + pip uninstall -y pyodide-build |
| 158 | + - uses: mymindstorm/setup-emsdk@v14 |
| 159 | + with: |
| 160 | + version: ${{ env.EMSCRIPTEN_VERSION }} |
| 161 | + actions-cache-folder: emsdk-cache |
| 162 | + - uses: actions/setup-python@v6 |
| 163 | + with: |
| 164 | + python-version: ${{ env.PYTHON_VERSION }} |
| 165 | + - run: pip install pyodide-build |
| 166 | + - name: Build wheels |
| 167 | + uses: PyO3/maturin-action@v1 |
| 168 | + with: |
| 169 | + target: ${{ matrix.platform.target }} |
| 170 | + args: --release --out dist -i ${{ env.PYTHON_VERSION }} |
| 171 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 172 | + rust-toolchain: nightly |
| 173 | + - name: Upload wheels |
| 174 | + uses: actions/upload-artifact@v6 |
| 175 | + with: |
| 176 | + name: wasm-wheels |
| 177 | + path: dist |
| 178 | + |
| 179 | + sdist: |
| 180 | + runs-on: ubuntu-latest |
| 181 | + steps: |
| 182 | + - uses: actions/checkout@v6 |
| 183 | + - name: Build sdist |
| 184 | + uses: PyO3/maturin-action@v1 |
| 185 | + with: |
| 186 | + command: sdist |
| 187 | + args: --out dist |
| 188 | + - name: Upload sdist |
| 189 | + uses: actions/upload-artifact@v6 |
| 190 | + with: |
| 191 | + name: wheels-sdist |
| 192 | + path: dist |
| 193 | + |
| 194 | + verify-main: |
| 195 | + name: Verify tag is on main |
| 196 | + runs-on: ubuntu-latest |
| 197 | + steps: |
| 198 | + - uses: actions/checkout@v6 |
| 199 | + with: |
| 200 | + fetch-depth: 0 |
| 201 | + - name: Verify tag is on main |
| 202 | + run: git branch --contains "$GITHUB_SHA" | grep -qE '(^|\s)main$' |
| 203 | + |
| 204 | + release: |
| 205 | + name: Release |
| 206 | + runs-on: ubuntu-latest |
| 207 | + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} |
| 208 | + needs: [linux, musllinux, windows, macos, emscripten, sdist, verify-main] |
| 209 | + permissions: |
| 210 | + # Use to sign the release artifacts |
| 211 | + id-token: write |
| 212 | + # Used to upload release artifacts |
| 213 | + contents: write |
| 214 | + # Used to generate artifact attestation |
| 215 | + attestations: write |
| 216 | + steps: |
| 217 | + - uses: actions/download-artifact@v7 |
| 218 | + - name: Generate artifact attestation |
| 219 | + uses: actions/attest-build-provenance@v3 |
| 220 | + with: |
| 221 | + subject-path: 'wheels-*/*' |
| 222 | + - name: Install uv |
| 223 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 224 | + uses: astral-sh/setup-uv@v7 |
| 225 | + - name: Publish to PyPI |
| 226 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 227 | + run: uv publish 'wheels-*/*' |
| 228 | + env: |
| 229 | + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 230 | + - name: Upload to GitHub Release |
| 231 | + uses: softprops/action-gh-release@v1 |
| 232 | + with: |
| 233 | + files: | |
| 234 | + wasm-wheels/*.whl |
| 235 | + prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} |
0 commit comments