|
| 1 | +# This file is autogenerated by maturin v1.7.4 |
| 2 | +# To update, run |
| 3 | +# |
| 4 | +# maturin generate-ci --pytest github |
| 5 | +# |
| 6 | +name: Build Package |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - master |
| 13 | + tags: |
| 14 | + - '*' |
| 15 | + pull_request: |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +jobs: |
| 22 | + linux: |
| 23 | + runs-on: ${{ matrix.platform.runner }} |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + platform: |
| 27 | + - runner: ubuntu-latest |
| 28 | + target: x86_64 |
| 29 | + - runner: ubuntu-latest |
| 30 | + target: x86 |
| 31 | + - runner: ubuntu-latest |
| 32 | + target: aarch64 |
| 33 | + - runner: ubuntu-latest |
| 34 | + target: armv7 |
| 35 | + - runner: ubuntu-latest |
| 36 | + target: s390x |
| 37 | + - runner: ubuntu-latest |
| 38 | + target: ppc64le |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: 3.x |
| 44 | + - name: Install OpenBLAS |
| 45 | + run: | |
| 46 | + sudo apt-get update |
| 47 | + sudo apt-get install -y libopenblas-dev liblapack-dev gfortran |
| 48 | + - name: Build wheels |
| 49 | + uses: PyO3/maturin-action@v1 |
| 50 | + with: |
| 51 | + target: ${{ matrix.platform.target }} |
| 52 | + args: --release --out dist --find-interpreter |
| 53 | + sccache: 'true' |
| 54 | + manylinux: auto |
| 55 | + - name: Upload wheels |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: wheels-linux-${{ matrix.platform.target }} |
| 59 | + path: dist |
| 60 | + - name: pytest |
| 61 | + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} |
| 62 | + shell: bash |
| 63 | + run: | |
| 64 | + set -e |
| 65 | + python3 -m venv .venv |
| 66 | + source .venv/bin/activate |
| 67 | + pip install kriss_matcher --find-links dist --force-reinstall |
| 68 | + pip install pytest |
| 69 | + pytest |
| 70 | + - name: pytest |
| 71 | + if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} |
| 72 | + uses: uraimo/run-on-arch-action@v2 |
| 73 | + with: |
| 74 | + arch: ${{ matrix.platform.target }} |
| 75 | + distro: ubuntu22.04 |
| 76 | + githubToken: ${{ github.token }} |
| 77 | + install: | |
| 78 | + apt-get update |
| 79 | + apt-get install -y --no-install-recommends python3 python3-pip |
| 80 | + pip3 install -U pip pytest |
| 81 | + run: | |
| 82 | + set -e |
| 83 | + pip3 install kriss_matcher --find-links dist --force-reinstall |
| 84 | + pytest |
| 85 | +
|
| 86 | + musllinux: |
| 87 | + runs-on: ${{ matrix.platform.runner }} |
| 88 | + strategy: |
| 89 | + matrix: |
| 90 | + platform: |
| 91 | + - runner: ubuntu-latest |
| 92 | + target: x86_64 |
| 93 | + - runner: ubuntu-latest |
| 94 | + target: x86 |
| 95 | + - runner: ubuntu-latest |
| 96 | + target: aarch64 |
| 97 | + - runner: ubuntu-latest |
| 98 | + target: armv7 |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + - uses: actions/setup-python@v5 |
| 102 | + with: |
| 103 | + python-version: 3.x |
| 104 | + - name: Install OpenBLAS |
| 105 | + run: | |
| 106 | + apk add openblas-dev lapack-dev gfortran |
| 107 | + - name: Build wheels |
| 108 | + uses: PyO3/maturin-action@v1 |
| 109 | + with: |
| 110 | + target: ${{ matrix.platform.target }} |
| 111 | + args: --release --out dist --find-interpreter |
| 112 | + sccache: 'true' |
| 113 | + manylinux: musllinux_1_2 |
| 114 | + - name: Upload wheels |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: wheels-musllinux-${{ matrix.platform.target }} |
| 118 | + path: dist |
| 119 | + - name: pytest |
| 120 | + if: ${{ startsWith(matrix.platform.target, 'x86_64') }} |
| 121 | + uses: addnab/docker-run-action@v3 |
| 122 | + with: |
| 123 | + image: alpine:latest |
| 124 | + options: -v ${{ github.workspace }}:/io -w /io |
| 125 | + run: | |
| 126 | + set -e |
| 127 | + apk add py3-pip py3-virtualenv |
| 128 | + python3 -m virtualenv .venv |
| 129 | + source .venv/bin/activate |
| 130 | + pip install kriss_matcher --no-index --find-links dist --force-reinstall |
| 131 | + pip install pytest |
| 132 | + pytest |
| 133 | + - name: pytest |
| 134 | + if: ${{ !startsWith(matrix.platform.target, 'x86') }} |
| 135 | + uses: uraimo/run-on-arch-action@v2 |
| 136 | + with: |
| 137 | + arch: ${{ matrix.platform.target }} |
| 138 | + distro: alpine_latest |
| 139 | + githubToken: ${{ github.token }} |
| 140 | + install: | |
| 141 | + apk add py3-virtualenv |
| 142 | + run: | |
| 143 | + set -e |
| 144 | + python3 -m virtualenv .venv |
| 145 | + source .venv/bin/activate |
| 146 | + pip install pytest |
| 147 | + pip install kriss_matcher --find-links dist --force-reinstall |
| 148 | + pytest |
| 149 | +
|
| 150 | + windows: |
| 151 | + runs-on: ${{ matrix.platform.runner }} |
| 152 | + strategy: |
| 153 | + matrix: |
| 154 | + platform: |
| 155 | + - runner: windows-latest |
| 156 | + target: x64 |
| 157 | + - runner: windows-latest |
| 158 | + target: x86 |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v4 |
| 161 | + - uses: actions/setup-python@v5 |
| 162 | + with: |
| 163 | + python-version: 3.x |
| 164 | + architecture: ${{ matrix.platform.target }} |
| 165 | + - name: Download and extract OpenBLAS |
| 166 | + run: | |
| 167 | + curl -L -o openblas.zip https://github.com/xianyi/OpenBLAS/releases/download/v0.3.28/OpenBLAS-0.3.28-x64.zip |
| 168 | + tar -xf openblas.zip -C C:/openblas |
| 169 | + - name: Set up OpenBLAS environment |
| 170 | + run: | |
| 171 | + setx /M OPENBLAS_DIR "C:\openblas" |
| 172 | + setx /M PATH "%PATH%;%OPENBLAS_DIR%\bin" |
| 173 | + setx /M OPENBLAS_NUM_THREADS 1 |
| 174 | + - name: Build wheels |
| 175 | + uses: PyO3/maturin-action@v1 |
| 176 | + with: |
| 177 | + target: ${{ matrix.platform.target }} |
| 178 | + args: --release --out dist --find-interpreter |
| 179 | + sccache: 'true' |
| 180 | + - name: Upload wheels |
| 181 | + uses: actions/upload-artifact@v4 |
| 182 | + with: |
| 183 | + name: wheels-windows-${{ matrix.platform.target }} |
| 184 | + path: dist |
| 185 | + - name: pytest |
| 186 | + if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} |
| 187 | + shell: bash |
| 188 | + run: | |
| 189 | + set -e |
| 190 | + python3 -m venv .venv |
| 191 | + source .venv/Scripts/activate |
| 192 | + pip install kriss_matcher --find-links dist --force-reinstall |
| 193 | + pip install pytest |
| 194 | + pytest |
| 195 | +
|
| 196 | + macos: |
| 197 | + runs-on: ${{ matrix.platform.runner }} |
| 198 | + strategy: |
| 199 | + matrix: |
| 200 | + platform: |
| 201 | + - runner: macos-12 |
| 202 | + target: x86_64 |
| 203 | + - runner: macos-14 |
| 204 | + target: aarch64 |
| 205 | + steps: |
| 206 | + - uses: actions/checkout@v4 |
| 207 | + - uses: actions/setup-python@v5 |
| 208 | + with: |
| 209 | + python-version: 3.x |
| 210 | + - name: Install OpenBLAS |
| 211 | + run: | |
| 212 | + brew install openblas lapack gcc |
| 213 | + - name: Build wheels |
| 214 | + uses: PyO3/maturin-action@v1 |
| 215 | + with: |
| 216 | + target: ${{ matrix.platform.target }} |
| 217 | + args: --release --out dist --find-interpreter |
| 218 | + sccache: 'true' |
| 219 | + - name: Upload wheels |
| 220 | + uses: actions/upload-artifact@v4 |
| 221 | + with: |
| 222 | + name: wheels-macos-${{ matrix.platform.target }} |
| 223 | + path: dist |
| 224 | + - name: pytest |
| 225 | + run: | |
| 226 | + set -e |
| 227 | + python3 -m venv .venv |
| 228 | + source .venv/bin/activate |
| 229 | + pip install kriss_matcher --find-links dist --force-reinstall |
| 230 | + pip install pytest |
| 231 | + pytest |
| 232 | +
|
| 233 | + sdist: |
| 234 | + runs-on: ubuntu-latest |
| 235 | + steps: |
| 236 | + - uses: actions/checkout@v4 |
| 237 | + - name: Build sdist |
| 238 | + uses: PyO3/maturin-action@v1 |
| 239 | + with: |
| 240 | + command: sdist |
| 241 | + args: --out dist |
| 242 | + - name: Upload sdist |
| 243 | + uses: actions/upload-artifact@v4 |
| 244 | + with: |
| 245 | + name: wheels-sdist |
| 246 | + path: dist |
| 247 | + |
| 248 | + release: |
| 249 | + name: Release |
| 250 | + runs-on: ubuntu-latest |
| 251 | + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} |
| 252 | + needs: [linux, musllinux, windows, macos, sdist] |
| 253 | + permissions: |
| 254 | + # Use to sign the release artifacts |
| 255 | + id-token: write |
| 256 | + # Used to upload release artifacts |
| 257 | + contents: write |
| 258 | + # Used to generate artifact attestation |
| 259 | + attestations: write |
| 260 | + steps: |
| 261 | + - uses: actions/download-artifact@v4 |
| 262 | + |
| 263 | + - name: Setup Rust toolchain |
| 264 | + uses: dtolnay/rust-toolchain@stable |
| 265 | + |
| 266 | + - name: cargo-release Cache |
| 267 | + id: cargo_release_cache |
| 268 | + uses: actions/cache@v4 |
| 269 | + with: |
| 270 | + path: ~/.cargo/bin/cargo-release |
| 271 | + key: ${{ runner.os }}-cargo-release |
| 272 | + |
| 273 | + - name: Install cargo-release |
| 274 | + run: cargo install cargo-release |
| 275 | + if: steps.cargo_release_cache.outputs.cache-hit != 'true' |
| 276 | + |
| 277 | + - name: cargo login |
| 278 | + run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }} |
| 279 | + |
| 280 | + - name: Publish crate to crates.io |
| 281 | + run: | |
| 282 | + cargo release \ |
| 283 | + publish \ |
| 284 | + --workspace \ |
| 285 | + --all-features \ |
| 286 | + --allow-branch HEAD \ |
| 287 | + --no-confirm \ |
| 288 | + --execute |
| 289 | +
|
| 290 | + - name: Generate artifact attestation |
| 291 | + uses: actions/attest-build-provenance@v1 |
| 292 | + with: |
| 293 | + subject-path: 'wheels-*/*' |
| 294 | + |
| 295 | + - name: Publish to PyPI |
| 296 | + if: "startsWith(github.ref, 'refs/tags/')" |
| 297 | + uses: PyO3/maturin-action@v1 |
| 298 | + env: |
| 299 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 300 | + with: |
| 301 | + command: upload |
| 302 | + args: --non-interactive --skip-existing wheels-*/* |
0 commit comments