|
| 1 | +# This file is autogenerated by maturin v1.0.1 |
| 2 | +# To update, run |
| 3 | +# |
| 4 | +# maturin generate-ci github --pytest |
| 5 | +# |
| 6 | +name: CI |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + tags: |
| 13 | + - 'v*' |
| 14 | + pull_request: |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + pre-commit: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + - uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: "3.9" |
| 29 | + - uses: pre-commit/action@v3.0.0 |
| 30 | + |
| 31 | + cargo-clippy: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - name: install rust stable |
| 36 | + uses: dtolnay/rust-toolchain@stable |
| 37 | + - name: cache rust |
| 38 | + uses: Swatinem/rust-cache@v2 |
| 39 | + - name: Run clippy |
| 40 | + run: cargo clippy |
| 41 | + |
| 42 | + test-python: |
| 43 | + |
| 44 | + runs-on: ubuntu-latest |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + python-version: |
| 49 | + - '3.9' |
| 50 | + - '3.10' |
| 51 | + - '3.11' |
| 52 | + - '3.12' |
| 53 | + - 'pypy3.9' |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - name: install rust stable |
| 57 | + uses: dtolnay/rust-toolchain@stable |
| 58 | + - name: cache rust |
| 59 | + uses: Swatinem/rust-cache@v2 |
| 60 | + with: |
| 61 | + key: test-v1 |
| 62 | + - name: set up python |
| 63 | + uses: actions/setup-python@v5 |
| 64 | + with: |
| 65 | + python-version: ${{ matrix.python-version }} |
| 66 | + - run: pip install -e .[testing] |
| 67 | + env: |
| 68 | + RUST_BACKTRACE: 1 |
| 69 | + - run: pip freeze |
| 70 | + - run: pytest |
| 71 | + |
| 72 | + linux: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + strategy: |
| 75 | + fail-fast: false |
| 76 | + matrix: |
| 77 | + target: |
| 78 | + - x86_64 |
| 79 | + - x86 |
| 80 | + - aarch64 |
| 81 | + - armv7 |
| 82 | + # - s390x # TODO build fails: "error: failed to run custom build command for `psm v0.1.21`"" |
| 83 | + - ppc64le |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v4 |
| 86 | + - uses: actions/setup-python@v5 |
| 87 | + with: |
| 88 | + python-version: "3.10" |
| 89 | + - name: Build wheels |
| 90 | + uses: PyO3/maturin-action@v1 |
| 91 | + with: |
| 92 | + target: ${{ matrix.target }} |
| 93 | + args: --release --out dist --find-interpreter |
| 94 | + sccache: 'true' |
| 95 | + manylinux: auto |
| 96 | + - name: Upload wheels |
| 97 | + uses: actions/upload-artifact@v3 |
| 98 | + with: |
| 99 | + name: wheels |
| 100 | + path: dist |
| 101 | + - name: pytest |
| 102 | + if: ${{ startsWith(matrix.target, 'x86_64') }} |
| 103 | + shell: bash |
| 104 | + run: | |
| 105 | + set -e |
| 106 | + pip install --upgrade pip |
| 107 | + pip install quickmark --find-links dist --force-reinstall |
| 108 | + pip install pytest pytest-param-files |
| 109 | + pytest |
| 110 | + - name: pytest |
| 111 | + if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'ppc64' }} |
| 112 | + uses: uraimo/run-on-arch-action@v2 |
| 113 | + with: |
| 114 | + arch: ${{ matrix.target }} |
| 115 | + distro: ubuntu22.04 |
| 116 | + githubToken: ${{ github.token }} |
| 117 | + install: | |
| 118 | + apt-get update |
| 119 | + apt-get install -y --no-install-recommends python3-dev python3-pip build-essential |
| 120 | + pip3 install -U pip pytest pytest-param-files |
| 121 | + run: | |
| 122 | + set -e |
| 123 | + pip3 install quickmark --find-links dist --force-reinstall |
| 124 | + pytest |
| 125 | +
|
| 126 | + windows: |
| 127 | + runs-on: windows-latest |
| 128 | + strategy: |
| 129 | + fail-fast: false |
| 130 | + matrix: |
| 131 | + target: [x64, x86] |
| 132 | + steps: |
| 133 | + - uses: actions/checkout@v4 |
| 134 | + - uses: actions/setup-python@v5 |
| 135 | + with: |
| 136 | + python-version: '3.10' |
| 137 | + architecture: ${{ matrix.target }} |
| 138 | + - name: Build wheels |
| 139 | + uses: PyO3/maturin-action@v1 |
| 140 | + with: |
| 141 | + target: ${{ matrix.target }} |
| 142 | + args: --release --out dist --find-interpreter |
| 143 | + sccache: 'true' |
| 144 | + - name: Upload wheels |
| 145 | + uses: actions/upload-artifact@v3 |
| 146 | + with: |
| 147 | + name: wheels |
| 148 | + path: dist |
| 149 | + - name: pytest |
| 150 | + if: ${{ !startsWith(matrix.target, 'aarch64') }} |
| 151 | + shell: bash |
| 152 | + run: | |
| 153 | + set -e |
| 154 | + pip install --upgrade pip |
| 155 | + pip install quickmark --find-links dist --force-reinstall |
| 156 | + pip install pytest pytest-param-files |
| 157 | + pytest |
| 158 | +
|
| 159 | + macos: |
| 160 | + runs-on: macos-latest |
| 161 | + strategy: |
| 162 | + fail-fast: false |
| 163 | + matrix: |
| 164 | + target: [x86_64, aarch64] |
| 165 | + steps: |
| 166 | + - uses: actions/checkout@v4 |
| 167 | + - uses: actions/setup-python@v5 |
| 168 | + with: |
| 169 | + python-version: '3.10' |
| 170 | + - name: Build wheels |
| 171 | + uses: PyO3/maturin-action@v1 |
| 172 | + with: |
| 173 | + target: ${{ matrix.target }} |
| 174 | + args: --release --out dist --find-interpreter |
| 175 | + sccache: 'true' |
| 176 | + - name: Upload wheels |
| 177 | + uses: actions/upload-artifact@v3 |
| 178 | + with: |
| 179 | + name: wheels |
| 180 | + path: dist |
| 181 | + - name: pytest |
| 182 | + if: ${{ !startsWith(matrix.target, 'aarch64') }} |
| 183 | + shell: bash |
| 184 | + run: | |
| 185 | + set -e |
| 186 | + pip install --upgrade pip |
| 187 | + pip install quickmark --find-links dist --force-reinstall |
| 188 | + pip install pytest pytest-param-files |
| 189 | + pytest |
| 190 | +
|
| 191 | + sdist: |
| 192 | + runs-on: ubuntu-latest |
| 193 | + steps: |
| 194 | + - uses: actions/checkout@v4 |
| 195 | + - name: Build sdist |
| 196 | + uses: PyO3/maturin-action@v1 |
| 197 | + with: |
| 198 | + command: sdist |
| 199 | + args: --out dist |
| 200 | + - name: Upload sdist |
| 201 | + uses: actions/upload-artifact@v3 |
| 202 | + with: |
| 203 | + name: wheels |
| 204 | + path: dist |
| 205 | + |
| 206 | + # https://github.com/marketplace/actions/alls-green#why used for branch protection checks |
| 207 | + check: |
| 208 | + if: always() |
| 209 | + needs: [pre-commit, cargo-clippy, test-python, linux, windows, macos, sdist] |
| 210 | + runs-on: ubuntu-latest |
| 211 | + steps: |
| 212 | + - name: Decide whether the needed jobs succeeded or failed |
| 213 | + uses: re-actors/alls-green@release/v1 |
| 214 | + with: |
| 215 | + jobs: ${{ toJSON(needs) }} |
| 216 | + allowed-failures: coverage |
| 217 | + |
| 218 | + release: |
| 219 | + runs-on: ubuntu-latest |
| 220 | + if: "startsWith(github.ref, 'refs/tags/')" |
| 221 | + needs: [pre-commit, cargo-clippy, test-python, linux, windows, macos, sdist] |
| 222 | + steps: |
| 223 | + - uses: actions/download-artifact@v3 |
| 224 | + with: |
| 225 | + name: wheels |
| 226 | + - name: Publish to PyPI |
| 227 | + uses: PyO3/maturin-action@v1 |
| 228 | + env: |
| 229 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 230 | + with: |
| 231 | + command: upload |
| 232 | + args: --skip-existing * |
0 commit comments