|
| 1 | +name: Wheels Build manylinux2014_x86_64 |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + schedule: |
| 5 | + - cron: "20 2 * * *" |
| 6 | + pull_request: |
| 7 | + paths: |
| 8 | + - .github/workflows/wheels_v2.yml |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + Build-Wheels: |
| 13 | + timeout-minutes: 60 |
| 14 | + |
| 15 | + runs-on: [self-hosted, CPU] |
| 16 | + permissions: |
| 17 | + id-token: write |
| 18 | + contents: read |
| 19 | + |
| 20 | + steps: |
| 21 | + |
| 22 | + - name: Prune stale docker containers |
| 23 | + run: | |
| 24 | + # If cibuildwheel crashes (or, say, is OOM-killed), it leaves behind a |
| 25 | + # docker container. Eventually these consume all the disk space on |
| 26 | + # this machine. |
| 27 | + docker container prune -f |
| 28 | +
|
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v3 |
| 31 | + |
| 32 | + # The LATEST_DATE here should be kept in sync with the one in Patch setup.py |
| 33 | + - id: check-version |
| 34 | + name: Check latest version |
| 35 | + run: | |
| 36 | + export PACKAGE_DATE=$(python3 -m pip install --user --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/Triton-Nightly/pypi/simple/ --dry-run triton-nightly== |& grep -oP '(?<=, )[0-9\.]+dev[0-9]+(?=\))' | grep -oP '(?<=dev)[0-9]+') |
| 37 | + export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd") |
| 38 | + if cmp -s <(echo $PACKAGE_DATE) <(echo $LATEST_DATE); then |
| 39 | + echo "new_commit=false" >> "$GITHUB_OUTPUT" |
| 40 | + else |
| 41 | + echo "new_commit=true" >> "$GITHUB_OUTPUT" |
| 42 | + fi |
| 43 | +
|
| 44 | + - name: Patch setup.py |
| 45 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 46 | + run: | |
| 47 | + echo "" >> python/setup.cfg |
| 48 | + echo "[build_ext]" >> python/setup.cfg |
| 49 | + echo "base-dir=/project" >> python/setup.cfg |
| 50 | +
|
| 51 | + - name: Build wheels |
| 52 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 53 | + run: | |
| 54 | + python3 -m pip install cibuildwheel --upgrade --user |
| 55 | + export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd") |
| 56 | + # Pass MAX_JOBS=4 because, at time of writing, the VM "only" has 32GB |
| 57 | + # of RAM and OOMs while building if we give it the default number of |
| 58 | + # workers (2 * NUM_CPUs). |
| 59 | + # |
| 60 | + # Sadly, I couldn't make TRITON_BUILD_WITH_CLANG_LLD=1 work. The |
| 61 | + # manylinux image has a relatively recent gcc (v10, released 2020), |
| 62 | + # but its clang is ancient, v3.4, released in 2014 (!). I tried |
| 63 | + # installing the prebuilt clang 10 binary distributed by LLVM, and I |
| 64 | + # quickly ran into Linux DLL hell. I give up, for now. Perhaps |
| 65 | + # manylinux_x_y will save us; I didn't try. |
| 66 | + export CIBW_ENVIRONMENT="MAX_JOBS=4 TRITON_WHEEL_NAME=triton" |
| 67 | + export CIBW_MANYLINUX_X86_64_IMAGE="quay.io/pypa/manylinux2014_x86_64:latest" |
| 68 | + #export CIBW_MANYLINUX_PYPY_X86_64_IMAGE="quay.io/pypa/manylinux2014_x86_64:latest" |
| 69 | + export CIBW_BEFORE_BUILD="pip install cmake;" |
| 70 | + export CIBW_SKIP="cp{35,36,37,38}-*" |
| 71 | + export CIBW_BUILD="cp3{9,10,11,12,13}-manylinux_x86_64" |
| 72 | + python3 -m cibuildwheel python --output-dir wheelhouse |
| 73 | +
|
| 74 | + - uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: cibw-wheels-manylinux2014-wheels-upload |
| 77 | + path: ./wheelhouse/*.whl |
| 78 | + |
| 79 | + - name: Upload wheels to PyPI |
| 80 | + if: false # Disable Upload to PyPI until ready for release |
| 81 | + run: | |
| 82 | + python3 -m twine upload wheelhouse/* -u __token__ -p ${{ secrets.PYPY_API_TOKEN }} |
0 commit comments