| 1 |
name: wheels |
| 2 |
on: |
| 3 |
push: |
| 4 |
tags: |
| 5 |
- '[0-9]+.[0-9]+.[0-9]+' |
| 6 |
workflow_dispatch: |
| 7 |
|
| 8 |
jobs: |
| 9 |
wheels: |
| 10 |
name: Build wheels |
| 11 |
runs-on: ${{ matrix.os }}-latest |
| 12 |
strategy: |
| 13 |
fail-fast: false |
| 14 |
matrix: |
| 15 |
include: |
| 16 |
- os: ubuntu |
| 17 |
architecture: x86_64 |
| 18 |
- os: ubuntu |
| 19 |
architecture: aarch64 |
| 20 |
- os: macos |
| 21 |
architecture: x86_64 |
| 22 |
- os: macos |
| 23 |
architecture: arm64 |
| 24 |
- os: windows |
| 25 |
architecture: AMD64 |
| 26 |
- os: windows |
| 27 |
architecture: x86 |
| 28 |
- os: windows |
| 29 |
architecture: ARM64 |
| 30 |
steps: |
| 31 |
- uses: actions/checkout@v4 |
| 32 |
- uses: docker/setup-qemu-action@v2 |
| 33 |
with: |
| 34 |
platforms: arm64 |
| 35 |
if: runner.os == 'Linux' && matrix.architecture == 'aarch64' |
| 36 |
|
| 37 |
- uses: bus1/cabuild/action/msdevshell@v1 |
| 38 |
with: |
| 39 |
architecture: x64 |
| 40 |
if: runner.os == 'Windows' && matrix.architecture == 'AMD64' |
| 41 |
- uses: bus1/cabuild/action/msdevshell@v1 |
| 42 |
with: |
| 43 |
architecture: x86 |
| 44 |
if: runner.os == 'Windows' && matrix.architecture == 'x86' |
| 45 |
|
| 46 |
- run: pipx run cibuildwheel~=2.21.0 |
| 47 |
env: |
| 48 |
CIBW_SKIP: pp* *-musllinux* |
| 49 |
CIBW_ARCHS: ${{ matrix.architecture }} |
| 50 |
CIBW_BEFORE_ALL_LINUX: | |
| 51 |
curl -sSfO https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz |
| 52 |
tar xJf bison-3.8.2.tar.xz |
| 53 |
cd bison-3.8.2 && ./configure && make && make install |
| 54 |
curl -sSfLO https://github.com/westes/flex/files/981163/flex-2.6.4.tar.gz |
| 55 |
tar xzf flex-2.6.4.tar.gz |
| 56 |
cd flex-2.6.4 && ./configure && make && make install |
| 57 |
CIBW_ENVIRONMENT_MACOS: | |
| 58 |
PATH="/opt/homebrew/opt/bison/bin:$PATH" |
| 59 |
CIBW_BEFORE_ALL_MACOS: | |
| 60 |
brew install bison |
| 61 |
CIBW_ENVIRONMENT_WINDOWS: | |
| 62 |
PATH="$PATH;C:/msys64/usr/bin" |
| 63 |
CIBW_BEFORE_ALL_WINDOWS: | |
| 64 |
pacman --noconfirm -S bison flex |
| 65 |
|
| 66 |
- uses: actions/upload-artifact@v4 |
| 67 |
with: |
| 68 |
name: wheels-${{ matrix.os }}-${{ matrix.architecture }} |
| 69 |
path: wheelhouse/*.whl |
| 70 |
|
| 71 |
sdist: |
| 72 |
name: Build source distribution |
| 73 |
runs-on: ubuntu-latest |
| 74 |
steps: |
| 75 |
- uses: actions/checkout@v4 |
| 76 |
- run: python -m pip install build |
| 77 |
- run: python -m build --sdist |
| 78 |
- uses: actions/upload-artifact@v4 |
| 79 |
with: |
| 80 |
name: source |
| 81 |
path: dist/*.tar.gz |
| 82 |
|
| 83 |
upload: |
| 84 |
name: Upload to PyPI |
| 85 |
needs: |
| 86 |
- wheels |
| 87 |
- sdist |
| 88 |
runs-on: ubuntu-latest |
| 89 |
steps: |
| 90 |
- uses: actions/download-artifact@v4 |
| 91 |
with: |
| 92 |
merge-multiple: true |
| 93 |
path: dist |
| 94 |
- run: python -m pip install twine |
| 95 |
- run: python -m twine upload --skip-existing dist/* |
| 96 |
env: |
| 97 |
TWINE_USERNAME: __token__ |
| 98 |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |