|
| 1 | +# This file is autogenerated by maturin v1.7.8 |
| 2 | +# To update, run |
| 3 | +# |
| 4 | +# maturin generate-ci github -m python/Cargo.toml -o .github/workflows/python.yml --pytest |
| 5 | +# |
| 6 | +name: Python bindings |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + tags: |
| 13 | + - 'python*' |
| 14 | + pull_request: |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + linux: |
| 22 | + runs-on: ${{ matrix.platform.runner }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + platform: |
| 26 | + - runner: ubuntu-22.04 |
| 27 | + target: x86_64 |
| 28 | + - runner: ubuntu-22.04 |
| 29 | + target: x86 |
| 30 | + - runner: ubuntu-22.04 |
| 31 | + target: aarch64 |
| 32 | + - runner: ubuntu-22.04 |
| 33 | + target: armv7 |
| 34 | + - runner: ubuntu-22.04 |
| 35 | + target: s390x |
| 36 | + - runner: ubuntu-22.04 |
| 37 | + target: ppc64le |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: actions/setup-python@v5 |
| 41 | + with: |
| 42 | + python-version: 3.x |
| 43 | + - name: Build wheels |
| 44 | + uses: PyO3/maturin-action@v1 |
| 45 | + with: |
| 46 | + target: ${{ matrix.platform.target }} |
| 47 | + args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml |
| 48 | + sccache: 'true' |
| 49 | + manylinux: auto |
| 50 | + - name: Upload wheels |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: wheels-linux-${{ matrix.platform.target }} |
| 54 | + path: dist |
| 55 | + - name: pytest |
| 56 | + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + set -e |
| 60 | + python3 -m venv .venv |
| 61 | + source .venv/bin/activate |
| 62 | + pip install pyodict --find-links dist --force-reinstall |
| 63 | + pip install pytest |
| 64 | + pip install syrupy |
| 65 | + cd python && pytest |
| 66 | + - name: pytest |
| 67 | + if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} |
| 68 | + uses: uraimo/run-on-arch-action@v2 |
| 69 | + with: |
| 70 | + arch: ${{ matrix.platform.target }} |
| 71 | + distro: ubuntu22.04 |
| 72 | + githubToken: ${{ github.token }} |
| 73 | + install: | |
| 74 | + apt-get update |
| 75 | + apt-get install -y --no-install-recommends python3 python3-pip |
| 76 | + pip3 install -U pip pytest syrupy |
| 77 | + run: | |
| 78 | + set -e |
| 79 | + pip3 install pyodict --find-links dist --force-reinstall |
| 80 | + cd python && pytest |
| 81 | +
|
| 82 | + musllinux: |
| 83 | + runs-on: ${{ matrix.platform.runner }} |
| 84 | + strategy: |
| 85 | + matrix: |
| 86 | + platform: |
| 87 | + - runner: ubuntu-22.04 |
| 88 | + target: x86_64 |
| 89 | + - runner: ubuntu-22.04 |
| 90 | + target: x86 |
| 91 | + - runner: ubuntu-22.04 |
| 92 | + target: aarch64 |
| 93 | + - runner: ubuntu-22.04 |
| 94 | + target: armv7 |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v4 |
| 97 | + - uses: actions/setup-python@v5 |
| 98 | + with: |
| 99 | + python-version: 3.x |
| 100 | + - name: Build wheels |
| 101 | + uses: PyO3/maturin-action@v1 |
| 102 | + with: |
| 103 | + target: ${{ matrix.platform.target }} |
| 104 | + args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml |
| 105 | + sccache: 'true' |
| 106 | + manylinux: musllinux_1_2 |
| 107 | + - name: Upload wheels |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: wheels-musllinux-${{ matrix.platform.target }} |
| 111 | + path: dist |
| 112 | + - name: pytest |
| 113 | + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} |
| 114 | + uses: addnab/docker-run-action@v3 |
| 115 | + with: |
| 116 | + image: alpine:latest |
| 117 | + options: -v ${{ github.workspace }}:/io -w /io |
| 118 | + run: | |
| 119 | + set -e |
| 120 | + apk add py3-pip py3-virtualenv |
| 121 | + python3 -m virtualenv .venv |
| 122 | + source .venv/bin/activate |
| 123 | + pip install pyodict --no-index --find-links dist --force-reinstall |
| 124 | + pip install pytest |
| 125 | + pip install syrupy |
| 126 | + cd python && pytest |
| 127 | + - name: pytest |
| 128 | + if: ${{ !startsWith(matrix.platform.target, 'x86') }} |
| 129 | + uses: uraimo/run-on-arch-action@v2 |
| 130 | + with: |
| 131 | + arch: ${{ matrix.platform.target }} |
| 132 | + distro: alpine_latest |
| 133 | + githubToken: ${{ github.token }} |
| 134 | + install: | |
| 135 | + apk add py3-virtualenv |
| 136 | + run: | |
| 137 | + set -e |
| 138 | + python3 -m virtualenv .venv |
| 139 | + source .venv/bin/activate |
| 140 | + pip install pytest |
| 141 | + pip install syrupy |
| 142 | + pip install pyodict --find-links dist --force-reinstall |
| 143 | + cd python && pytest |
| 144 | +
|
| 145 | + windows: |
| 146 | + runs-on: ${{ matrix.platform.runner }} |
| 147 | + strategy: |
| 148 | + matrix: |
| 149 | + platform: |
| 150 | + - runner: windows-latest |
| 151 | + target: x64 |
| 152 | + - runner: windows-latest |
| 153 | + target: x86 |
| 154 | + steps: |
| 155 | + - uses: actions/checkout@v4 |
| 156 | + - uses: actions/setup-python@v5 |
| 157 | + with: |
| 158 | + python-version: 3.x |
| 159 | + architecture: ${{ matrix.platform.target }} |
| 160 | + - name: Build wheels |
| 161 | + uses: PyO3/maturin-action@v1 |
| 162 | + with: |
| 163 | + target: ${{ matrix.platform.target }} |
| 164 | + args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml |
| 165 | + sccache: 'true' |
| 166 | + - name: Upload wheels |
| 167 | + uses: actions/upload-artifact@v4 |
| 168 | + with: |
| 169 | + name: wheels-windows-${{ matrix.platform.target }} |
| 170 | + path: dist |
| 171 | + - name: pytest |
| 172 | + if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} |
| 173 | + shell: bash |
| 174 | + run: | |
| 175 | + set -e |
| 176 | + python3 -m venv .venv |
| 177 | + source .venv/Scripts/activate |
| 178 | + pip install pyodict --find-links dist --force-reinstall |
| 179 | + pip install pytest |
| 180 | + pip install syrupy |
| 181 | + cd python && pytest |
| 182 | +
|
| 183 | + macos: |
| 184 | + runs-on: ${{ matrix.platform.runner }} |
| 185 | + strategy: |
| 186 | + matrix: |
| 187 | + platform: |
| 188 | + - runner: macos-13 |
| 189 | + target: x86_64 |
| 190 | + - runner: macos-14 |
| 191 | + target: aarch64 |
| 192 | + steps: |
| 193 | + - uses: actions/checkout@v4 |
| 194 | + - uses: actions/setup-python@v5 |
| 195 | + with: |
| 196 | + python-version: 3.x |
| 197 | + - name: Build wheels |
| 198 | + uses: PyO3/maturin-action@v1 |
| 199 | + with: |
| 200 | + target: ${{ matrix.platform.target }} |
| 201 | + args: --release --out dist --find-interpreter --manifest-path python/Cargo.toml |
| 202 | + sccache: 'true' |
| 203 | + - name: Upload wheels |
| 204 | + uses: actions/upload-artifact@v4 |
| 205 | + with: |
| 206 | + name: wheels-macos-${{ matrix.platform.target }} |
| 207 | + path: dist |
| 208 | + - name: pytest |
| 209 | + run: | |
| 210 | + set -e |
| 211 | + python3 -m venv .venv |
| 212 | + source .venv/bin/activate |
| 213 | + pip install pyodict --find-links dist --force-reinstall |
| 214 | + pip install pytest |
| 215 | + pip install syrupy |
| 216 | + cd python && pytest |
| 217 | +
|
| 218 | + sdist: |
| 219 | + runs-on: ubuntu-latest |
| 220 | + steps: |
| 221 | + - uses: actions/checkout@v4 |
| 222 | + - name: Build sdist |
| 223 | + uses: PyO3/maturin-action@v1 |
| 224 | + with: |
| 225 | + command: sdist |
| 226 | + args: --out dist --manifest-path python/Cargo.toml |
| 227 | + - name: Upload sdist |
| 228 | + uses: actions/upload-artifact@v4 |
| 229 | + with: |
| 230 | + name: wheels-sdist |
| 231 | + path: dist |
| 232 | + |
| 233 | + release: |
| 234 | + name: Release |
| 235 | + runs-on: ubuntu-latest |
| 236 | + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} |
| 237 | + needs: [linux, musllinux, windows, macos, sdist] |
| 238 | + permissions: |
| 239 | + # Use to sign the release artifacts |
| 240 | + id-token: write |
| 241 | + # Used to upload release artifacts |
| 242 | + contents: write |
| 243 | + # Used to generate artifact attestation |
| 244 | + attestations: write |
| 245 | + steps: |
| 246 | + - uses: actions/download-artifact@v4 |
| 247 | + - name: Generate artifact attestation |
| 248 | + uses: actions/attest-build-provenance@v1 |
| 249 | + with: |
| 250 | + subject-path: 'wheels-*/*' |
| 251 | + - name: Publish to PyPI |
| 252 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 253 | + uses: PyO3/maturin-action@v1 |
| 254 | + env: |
| 255 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
| 256 | + with: |
| 257 | + command: upload |
| 258 | + args: --non-interactive --skip-existing wheels-*/* |
0 commit comments