|
| 1 | +name: Wheels |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + schedule: |
| 5 | + - cron: "0 8 * * *" |
| 6 | + pull_request: |
| 7 | + paths: |
| 8 | + - .github/workflows/wheels_v2.yml |
| 9 | + |
| 10 | +permissions: read-all |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + Build-Wheels: |
| 15 | + timeout-minutes: 60 |
| 16 | + |
| 17 | + runs-on: [self-hosted, CPU] |
| 18 | + permissions: |
| 19 | + id-token: write |
| 20 | + contents: read |
| 21 | + |
| 22 | + steps: |
| 23 | + |
| 24 | + - name: Prune stale docker containers |
| 25 | + run: | |
| 26 | + # If cibuildwheel crashes (or, say, is OOM-killed), it leaves behind a |
| 27 | + # docker container. Eventually these consume all the disk space on |
| 28 | + # this machine. |
| 29 | + docker container prune -f |
| 30 | +
|
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + # The LATEST_DATE here should be kept in sync with the one in Patch setup.py |
| 35 | + - id: check-version |
| 36 | + name: Check latest version |
| 37 | + run: | |
| 38 | + 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]+') |
| 39 | + export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd") |
| 40 | + if cmp -s <(echo $PACKAGE_DATE) <(echo $LATEST_DATE); then |
| 41 | + echo "new_commit=false" >> "$GITHUB_OUTPUT" |
| 42 | + else |
| 43 | + echo "new_commit=true" >> "$GITHUB_OUTPUT" |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Patch setup.py |
| 47 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 48 | + run: | |
| 49 | + echo "" >> python/setup.cfg |
| 50 | + echo "[build_ext]" >> python/setup.cfg |
| 51 | + echo "base-dir=/project" >> python/setup.cfg |
| 52 | +
|
| 53 | + - name: Build wheels |
| 54 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 55 | + run: | |
| 56 | + python3 -m pip install cibuildwheel --upgrade --user |
| 57 | + export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd") |
| 58 | + # Pass MAX_JOBS=4 because, at time of writing, the VM "only" has 32GB |
| 59 | + # of RAM and OOMs while building if we give it the default number of |
| 60 | + # workers (2 * NUM_CPUs). |
| 61 | + export CIBW_ENVIRONMENT="MAX_JOBS=4 \ |
| 62 | + TRITON_BUILD_WITH_CLANG_LLD=1" |
| 63 | + export CIBW_MANYLINUX_X86_64_IMAGE="quay.io/pypa/manylinux_2_28_x86_64:latest" |
| 64 | + #export CIBW_MANYLINUX_PYPY_X86_64_IMAGE="quay.io/pypa/manylinux_2_28_x86_64:latest" |
| 65 | + # many_linux_2_28 image comes with GCC 12.2.1, but not clang. |
| 66 | + # With this install, it gets clang 16.0.6. |
| 67 | + export CIBW_BEFORE_ALL="dnf install clang lld -y"; |
| 68 | + export CIBW_SKIP="cp{35,36,37}-*" |
| 69 | + export CIBW_BUILD="cp3{9,10,11,12,13}-manylinux_x86_64" |
| 70 | + python3 -m cibuildwheel python --output-dir wheelhouse |
| 71 | +
|
| 72 | + - uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: cibw-wheels-manylinux_2_28_x86_64-wheels-upload |
| 75 | + path: ./wheelhouse/*.whl |
| 76 | + |
| 77 | + - name: Install Azure CLI |
| 78 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 79 | + run: | |
| 80 | + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash |
| 81 | +
|
| 82 | + - name: Azure login |
| 83 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 84 | + uses: azure/login@v2 |
| 85 | + with: |
| 86 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 87 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 88 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 89 | + |
| 90 | + - id: generate-token |
| 91 | + name: Generate token |
| 92 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 93 | + run: | |
| 94 | + AZ_TOKEN=$(az account get-access-token --query accessToken) |
| 95 | + echo "::add-mask::$AZ_TOKEN" |
| 96 | + echo "access_token=$AZ_TOKEN" >> "$GITHUB_OUTPUT" |
| 97 | +
|
| 98 | + - name: Publish wheels to Azure DevOps |
| 99 | + if: ${{ steps.check-version.outputs.new_commit == 'true' }} |
| 100 | + run: | |
| 101 | + python3 -m pip install twine |
| 102 | + python3 -m twine upload -r Triton-Nightly -u TritonArtifactsSP -p ${{ steps.generate-token.outputs.access_token }} --config-file utils/nightly.pypirc --non-interactive --verbose wheelhouse/* |
| 103 | +
|
| 104 | + - name: Azure Logout |
| 105 | + if: ${{ steps.check-version.outputs.new_commit == 'true' && (success() || failure()) }} |
| 106 | + run: | |
| 107 | + az logout |
| 108 | + az cache purge |
| 109 | + az account clear |
0 commit comments