openai/tiktoken
Publicmirrored fromhttps://github.com/openai/tiktokenAvailable
.github/workflows/build_wheels.yml
83lines · modecode
| 1 | name: Build wheels |
| 2 | |
| 3 | on: [push, pull_request, workflow_dispatch] |
| 4 | |
| 5 | concurrency: |
| 6 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 7 | cancel-in-progress: true |
| 8 | |
| 9 | jobs: |
| 10 | build_wheels: |
| 11 | name: py${{ matrix.python-version }} on ${{ matrix.os }} |
| 12 | runs-on: ${{ matrix.os }} |
| 13 | strategy: |
| 14 | fail-fast: false |
| 15 | matrix: |
| 16 | # cibuildwheel builds linux wheels inside a manylinux container |
| 17 | # it also takes care of procuring the correct python version for us |
| 18 | os: [ubuntu-latest, windows-latest, macos-latest] |
| 19 | python-version: [38, 39, 310, 311, 312] |
| 20 | |
| 21 | steps: |
| 22 | - uses: actions/checkout@v4 |
| 23 | |
| 24 | - uses: pypa/cibuildwheel@v2.16.2 |
| 25 | env: |
| 26 | CIBW_BUILD: "cp${{ matrix.python-version}}-*" |
| 27 | |
| 28 | - uses: actions/upload-artifact@v3 |
| 29 | with: |
| 30 | name: dist |
| 31 | path: ./wheelhouse/*.whl |
| 32 | |
| 33 | build_wheels_aarch64: |
| 34 | name: py${{ matrix.python-version }} on ${{ matrix.os }} (aarch64) |
| 35 | runs-on: ${{ matrix.os }} |
| 36 | strategy: |
| 37 | fail-fast: false |
| 38 | matrix: |
| 39 | os: [ubuntu-latest] |
| 40 | python-version: [38, 39, 310, 311, 312] |
| 41 | |
| 42 | steps: |
| 43 | - uses: actions/checkout@v4 |
| 44 | |
| 45 | - name: Setup up QEMU |
| 46 | uses: docker/setup-qemu-action@v3 |
| 47 | with: |
| 48 | platforms: arm64 |
| 49 | |
| 50 | - name: Build wheels |
| 51 | uses: pypa/cibuildwheel@v2.16.2 |
| 52 | env: |
| 53 | CIBW_BUILD: "cp${{ matrix.python-version}}-*" |
| 54 | CIBW_ARCHS: aarch64 |
| 55 | CIBW_BUILD_VERBOSITY: 3 |
| 56 | # https://github.com/rust-lang/cargo/issues/10583 |
| 57 | CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI=true |
| 58 | - uses: actions/upload-artifact@v3 |
| 59 | with: |
| 60 | name: dist |
| 61 | path: ./wheelhouse/*.whl |
| 62 | |
| 63 | build_sdist: |
| 64 | name: sdist |
| 65 | runs-on: ubuntu-latest |
| 66 | steps: |
| 67 | - uses: actions/checkout@v4 |
| 68 | - uses: actions/setup-python@v4 |
| 69 | name: Install Python |
| 70 | with: |
| 71 | python-version: "3.9" |
| 72 | - name: Run check-manifest |
| 73 | run: | |
| 74 | pip install check-manifest |
| 75 | check-manifest -v |
| 76 | - name: Build sdist |
| 77 | run: | |
| 78 | pip install --upgrade build |
| 79 | python -m build --sdist |
| 80 | - uses: actions/upload-artifact@v3 |
| 81 | with: |
| 82 | name: dist |
| 83 | path: ./dist/*.tar.gz |
| 84 | |