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