|
| 1 | +name: Publish to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build_wheels: |
| 8 | + name: Build wheels on ${{ matrix.os }} |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + os: [ubuntu-20.04, windows-2019, macos-11] |
| 13 | + env: |
| 14 | + CIBW_BEFORE_ALL_LINUX: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y" |
| 15 | + CIBW_BUILD_VERBOSITY: "1" |
| 16 | + CIBW_SKIP: cp39-musllinux_i686 cp310-musllinux_i686 cp311-musllinux_i686 cp312-musllinux_i686 # Can't install Rust on musl based Linux systems |
| 17 | + CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up QEMU |
| 23 | + if: runner.os == 'Linux' |
| 24 | + uses: docker/setup-qemu-action@v1 |
| 25 | + with: |
| 26 | + platforms: all |
| 27 | + |
| 28 | + - name: Build wheels |
| 29 | + uses: pypa/cibuildwheel@v2.16.2 |
| 30 | + with: |
| 31 | + package-dir: ./python |
| 32 | + output-dir: ./python/wheelhouse |
| 33 | + |
| 34 | + - uses: actions/upload-artifact@v3 |
| 35 | + with: |
| 36 | + name: wheel-${{ runner.os }} |
| 37 | + path: ./python/wheelhouse/*.whl |
| 38 | + |
| 39 | + build_sdist: |
| 40 | + name: Build source distribution |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v2 |
| 44 | + |
| 45 | + - name: Install rust |
| 46 | + uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + toolchain: stable |
| 49 | + profile: minimal |
| 50 | + |
| 51 | + - uses: actions/setup-python@v2 |
| 52 | + name: Install Python |
| 53 | + with: |
| 54 | + python-version: "3.9" |
| 55 | + |
| 56 | + - name: Build sdist |
| 57 | + run: | |
| 58 | + python -m pip install setuptools-rust setuptools wheel |
| 59 | + cd python/ |
| 60 | + python setup.py sdist |
| 61 | +
|
| 62 | + - uses: actions/upload-artifact@v2 |
| 63 | + with: |
| 64 | + name: sdist-${{ runner.os }} |
| 65 | + path: python/dist/*.tar.gz |
| 66 | + |
| 67 | +# release: |
| 68 | +# needs: [build_wheels, build_sdist] |
| 69 | +# runs-on: ubuntu-latest |
| 70 | +# steps: |
| 71 | +# - uses: actions/download-artifact@v2 |
| 72 | +# with: |
| 73 | +# name: artifact |
| 74 | +# path: python/dist |
| 75 | + |
| 76 | +# - uses: pypa/gh-action-pypi-publish@release/v1 |
| 77 | +# with: |
| 78 | +# packages-dir: python/dist/ |
| 79 | +# user: __token__ |
| 80 | +# password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments