openai/tiktoken
Publicmirrored from https://github.com/openai/tiktokenAvailable
.github/workflows/build_wheels.yml
94lines · 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 | timeout-minutes: 60 |
| 14 | strategy: |
| 15 | fail-fast: false |
| 16 | matrix: |
| 17 | # cibuildwheel builds linux wheels inside a manylinux container |
| 18 | # it also takes care of procuring the correct python version for us |
| 19 | os: [ubuntu-latest, windows-latest, macos-latest] |
| 20 | python-version: [39, 310, 311, 312, 313] |
| 21 | |
| 22 | steps: |
| 23 | - uses: actions/checkout@v4 |
| 24 | |
| 25 | - uses: pypa/cibuildwheel@v2.22.0 |
| 26 | env: |
| 27 | CIBW_BUILD: "cp${{ matrix.python-version}}-*" |
| 28 | |
| 29 | - uses: actions/upload-artifact@v4 |
| 30 | with: |
| 31 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 32 | path: ./wheelhouse/*.whl |
| 33 | |
| 34 | build_wheels_aarch64: |
| 35 | name: py${{ matrix.python-version }} on ${{ matrix.os }} (aarch64) |
| 36 | runs-on: ${{ matrix.os }} |
| 37 | timeout-minutes: 60 |
| 38 | strategy: |
| 39 | fail-fast: false |
| 40 | matrix: |
| 41 | os: [ubuntu-24.04-arm] |
| 42 | python-version: [39, 310, 311, 312, 313] |
| 43 | |
| 44 | steps: |
| 45 | - uses: actions/checkout@v4 |
| 46 | |
| 47 | - name: Build wheels |
| 48 | uses: pypa/cibuildwheel@v2.22.0 |
| 49 | env: |
| 50 | CIBW_BUILD: "cp${{ matrix.python-version}}-*" |
| 51 | CIBW_ARCHS: aarch64 |
| 52 | CIBW_BUILD_VERBOSITY: 3 |
| 53 | # https://github.com/rust-lang/cargo/issues/10583 |
| 54 | CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI=true |
| 55 | |
| 56 | - uses: actions/upload-artifact@v4 |
| 57 | with: |
| 58 | name: cibw-wheels-aarch64-${{ matrix.os }}-${{ strategy.job-index }} |
| 59 | path: ./wheelhouse/*.whl |
| 60 | |
| 61 | build_sdist: |
| 62 | name: sdist |
| 63 | runs-on: ubuntu-latest |
| 64 | timeout-minutes: 60 |
| 65 | steps: |
| 66 | - uses: actions/checkout@v4 |
| 67 | - uses: actions/setup-python@v5 |
| 68 | name: Install Python |
| 69 | with: |
| 70 | python-version: "3.9" |
| 71 | - name: Run check-manifest |
| 72 | run: | |
| 73 | pip install check-manifest |
| 74 | check-manifest -v |
| 75 | - name: Build sdist |
| 76 | run: | |
| 77 | pip install --upgrade build |
| 78 | python -m build --sdist |
| 79 | - uses: actions/upload-artifact@v4 |
| 80 | with: |
| 81 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 82 | path: ./dist/*.tar.gz |
| 83 | |
| 84 | join_artifacts: |
| 85 | name: Join artifacts |
| 86 | runs-on: ubuntu-latest |
| 87 | needs: [build_wheels, build_wheels_aarch64, build_sdist] |
| 88 | steps: |
| 89 | - name: Merge artifacts |
| 90 | uses: actions/upload-artifact/merge@v4 |
| 91 | with: |
| 92 | name: cibw-wheels |
| 93 | pattern: cibw-wheels-* |
| 94 | delete-merged: true |
| 95 | |