|
| 1 | +# This file is based on the autogenerated one by maturin v1.7.8 with: |
| 2 | +# |
| 3 | +# maturin generate-ci github |
| 4 | +# |
| 5 | +# Differences are: |
| 6 | +# - removed x86, armv7, s390x, ppc64le targets from Linux |
| 7 | +# - removed free-threaded wheels |
| 8 | +# - removed musllinux |
| 9 | +# - have separate linux-just-test and linux-min-versions-just-test jobs |
| 10 | +# - add the `RUSTFLAGS: "-Dwarnings"` env variable |
| 11 | + |
| 12 | + |
| 13 | +name: CI |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - main |
| 19 | + - master |
| 20 | + tags: |
| 21 | + - '*' |
| 22 | + pull_request: |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +# Make sure CI fails on all warnings, including Clippy lints |
| 29 | +env: |
| 30 | + RUSTFLAGS: "-Dwarnings" |
| 31 | + |
| 32 | +jobs: |
| 33 | + linux-just-test: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + target: [x86_64] |
| 38 | + python-version: ["3.9", "3.11", "3.13"] |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + |
| 45 | + - name: Set up Rust |
| 46 | + run: rustup show |
| 47 | + - uses: mozilla-actions/[email protected] |
| 48 | + - run: make venv |
| 49 | + - run: make pre-commit |
| 50 | + - run: make install |
| 51 | + - run: make test |
| 52 | + |
| 53 | + linux-min-versions-just-test: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + target: [x86_64] |
| 58 | + python-version: ["3.9"] |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + - uses: actions/setup-python@v5 |
| 62 | + with: |
| 63 | + python-version: ${{ matrix.python-version }} |
| 64 | + |
| 65 | + - name: Set up Rust |
| 66 | + run: rustup show |
| 67 | + - uses: mozilla-actions/[email protected] |
| 68 | + - run: make venv |
| 69 | + - run: .venv/bin/python -m pip install polars==1.3.0 # min version |
| 70 | + - run: make install |
| 71 | + - run: make test |
| 72 | + |
| 73 | + linux: |
| 74 | + runs-on: ${{ matrix.platform.runner }} |
| 75 | + strategy: |
| 76 | + matrix: |
| 77 | + platform: |
| 78 | + - runner: ubuntu-22.04 |
| 79 | + target: x86_64 |
| 80 | + - runner: ubuntu-22.04 |
| 81 | + target: aarch64 |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + - uses: actions/setup-python@v5 |
| 85 | + with: |
| 86 | + python-version: 3.x |
| 87 | + - name: Build wheels |
| 88 | + uses: PyO3/maturin-action@v1 |
| 89 | + with: |
| 90 | + target: ${{ matrix.platform.target }} |
| 91 | + args: --release --out dist |
| 92 | + sccache: 'true' |
| 93 | + manylinux: auto |
| 94 | + - name: Upload wheels |
| 95 | + uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: wheels-linux-${{ matrix.platform.target }} |
| 98 | + path: dist |
| 99 | + |
| 100 | + windows: |
| 101 | + runs-on: ${{ matrix.platform.runner }} |
| 102 | + strategy: |
| 103 | + matrix: |
| 104 | + platform: |
| 105 | + - runner: windows-latest |
| 106 | + target: x64 |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v4 |
| 109 | + - uses: actions/setup-python@v5 |
| 110 | + with: |
| 111 | + python-version: 3.x |
| 112 | + architecture: ${{ matrix.platform.target }} |
| 113 | + - name: Build wheels |
| 114 | + uses: PyO3/maturin-action@v1 |
| 115 | + with: |
| 116 | + target: ${{ matrix.platform.target }} |
| 117 | + args: --release --out dist |
| 118 | + sccache: 'true' |
| 119 | + - name: Upload wheels |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: wheels-windows-${{ matrix.platform.target }} |
| 123 | + path: dist |
| 124 | + |
| 125 | + macos: |
| 126 | + runs-on: ${{ matrix.platform.runner }} |
| 127 | + strategy: |
| 128 | + matrix: |
| 129 | + platform: |
| 130 | + - runner: macos-13 |
| 131 | + target: x86_64 |
| 132 | + - runner: macos-14 |
| 133 | + target: aarch64 |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v4 |
| 136 | + - uses: actions/setup-python@v5 |
| 137 | + with: |
| 138 | + python-version: 3.x |
| 139 | + - name: Build wheels |
| 140 | + uses: PyO3/maturin-action@v1 |
| 141 | + with: |
| 142 | + target: ${{ matrix.platform.target }} |
| 143 | + args: --release --out dist |
| 144 | + sccache: 'true' |
| 145 | + - name: Upload wheels |
| 146 | + uses: actions/upload-artifact@v4 |
| 147 | + with: |
| 148 | + name: wheels-macos-${{ matrix.platform.target }} |
| 149 | + path: dist |
| 150 | + |
| 151 | + sdist: |
| 152 | + runs-on: ubuntu-latest |
| 153 | + steps: |
| 154 | + - uses: actions/checkout@v4 |
| 155 | + - name: Build sdist |
| 156 | + uses: PyO3/maturin-action@v1 |
| 157 | + with: |
| 158 | + command: sdist |
| 159 | + args: --out dist |
| 160 | + - name: Upload sdist |
| 161 | + uses: actions/upload-artifact@v4 |
| 162 | + with: |
| 163 | + name: wheels-sdist |
| 164 | + path: dist |
| 165 | + |
| 166 | + release: |
| 167 | + name: Release |
| 168 | + runs-on: ubuntu-latest |
| 169 | + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} |
| 170 | + needs: [linux, windows, macos, sdist] |
| 171 | + environment: pypi |
| 172 | + permissions: |
| 173 | + # Use to sign the release artifacts |
| 174 | + id-token: write |
| 175 | + # Used to upload release artifacts |
| 176 | + contents: write |
| 177 | + # Used to generate artifact attestation |
| 178 | + attestations: write |
| 179 | + steps: |
| 180 | + - uses: actions/download-artifact@v4 |
| 181 | + - name: Generate artifact attestation |
| 182 | + uses: actions/attest-build-provenance@v1 |
| 183 | + with: |
| 184 | + subject-path: 'wheels-*/*' |
| 185 | + - name: Publish to PyPI |
| 186 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 187 | + uses: PyO3/maturin-action@v1 |
| 188 | + env: |
| 189 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 190 | + with: |
| 191 | + command: upload |
| 192 | + args: --non-interactive --skip-existing wheels-*/* |
| 193 | + |
0 commit comments