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