|
| 1 | +name: Triton wheels |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +permissions: read-all |
| 7 | + |
| 8 | +env: |
| 9 | + NEW_WORKSPACE: C:\gh${{ github.run_id }} |
| 10 | + |
| 11 | +jobs: |
| 12 | + windows: |
| 13 | + runs-on: |
| 14 | + - windows |
| 15 | + - b580 |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + python: |
| 19 | + - "3.9" |
| 20 | + - "3.10" |
| 21 | + - "3.11" |
| 22 | + - "3.12" |
| 23 | + - "3.13" |
| 24 | + fail-fast: false |
| 25 | + max-parallel: 2 |
| 26 | + steps: |
| 27 | + - name: Checkout Triton repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Setup Python |
| 31 | + uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: "3.12" |
| 34 | + |
| 35 | + - name: Clean up old workspaces |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + rm -rf /c/gh* |
| 39 | +
|
| 40 | + # Copy workspace to a temporary location with a shorter name. |
| 41 | + - name: Copy workspace |
| 42 | + run: | |
| 43 | + Copy-Item -Path ${{ github.workspace }} -Destination ${{ env.NEW_WORKSPACE }} -Recurse |
| 44 | +
|
| 45 | + - name: Create venv |
| 46 | + run: | |
| 47 | + cd ${{ env.NEW_WORKSPACE }} |
| 48 | + python -m venv .venv |
| 49 | +
|
| 50 | + - name: Install build dependencies |
| 51 | + run: | |
| 52 | + cd ${{ env.NEW_WORKSPACE }} |
| 53 | + .venv\Scripts\activate.ps1 |
| 54 | + pip install cibuildwheel |
| 55 | +
|
| 56 | + - name: Set Triton version |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + cd /c/gh${{ github.run_id }} |
| 60 | + version="$(./scripts/triton-version.sh)" |
| 61 | + version="$version.post$GITHUB_RUN_NUMBER+git$(git rev-parse --short=7 HEAD)" |
| 62 | + ./scripts/triton-version.sh "$version" |
| 63 | + echo "Triton version: $(./scripts/triton-version.sh)" |
| 64 | +
|
| 65 | + - name: Build Triton wheels |
| 66 | + run: | |
| 67 | + cd ${{ env.NEW_WORKSPACE }} |
| 68 | + .venv\Scripts\activate.ps1 |
| 69 | + Invoke-BatchFile "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 |
| 70 | +
|
| 71 | + $env:CIBW_BUILD_VERBOSITY = "1" |
| 72 | + $env:CIBW_SKIP = "cp{35,36,37}-*" |
| 73 | + $env:CIBW_BUILD = "cp" + "${{ matrix.python}}".replace(".", "") + "*-win_amd64" |
| 74 | + $env:CIBW_CACHE_PATH = "${{ env.NEW_WORKSPACE }}/cibw" |
| 75 | +
|
| 76 | + python -m cibuildwheel --output-dir wheelhouse |
| 77 | +
|
| 78 | + - name: Artifact name |
| 79 | + run: | |
| 80 | + (Get-ChildItem -Path "${{ env.NEW_WORKSPACE }}\wheelhouse\*.whl").Name | Tee-Object -Variable WHEELS_NAME |
| 81 | + echo "WHEELS_NAME=$WHEELS_NAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 82 | +
|
| 83 | + - name: Upload wheels |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: ${{ env.WHEELS_NAME }} |
| 87 | + path: ${{ env.NEW_WORKSPACE }}\wheelhouse\*.whl |
| 88 | + |
| 89 | + - name: Clean up workspace |
| 90 | + if: ${{ always() }} |
| 91 | + run: | |
| 92 | + Remove-Item -LiteralPath ${{ env.NEW_WORKSPACE }} -Force -Recurse -ErrorAction Ignore |
| 93 | +
|
| 94 | + - name: Clean up temporary files |
| 95 | + if: ${{ always() }} |
| 96 | + shell: bash |
| 97 | + run: | |
| 98 | + rm -rf rm -rf /tmp/triton-* /tmp/tmp* |
0 commit comments