|
| 1 | +name: Build Release and Publish windows wheels |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + # Runs at 11:00 AM UTC, which is 3:00 AM PST (UTC-8) |
| 7 | + - cron: '0 11 * * *' |
| 8 | + |
| 9 | +# Ensure that only a single job or workflow using the same |
| 10 | +# concurrency group will run at a time. This would cancel |
| 11 | +# any in-progress jobs in the same github workflow and github |
| 12 | +# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge). |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build_x64_msvc: |
| 19 | + name: windows x86_64 msvc Build |
| 20 | + runs-on: windows-2022 |
| 21 | + defaults: |
| 22 | + run: |
| 23 | + shell: bash |
| 24 | + # Elevates permissions for `GITHUB_TOKEN`'s content scope (to allow this action to make a release) |
| 25 | + permissions: |
| 26 | + contents: write |
| 27 | + # Don't run this in everyone's forks. |
| 28 | + if: github.repository == 'llvm/torch-mlir-release' |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + package: [torch-mlir] |
| 32 | + py_version: [cp310-cp310, cp311-cp311] |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout torch-mlir |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + repository: llvm/torch-mlir |
| 39 | + ref: refs/heads/main |
| 40 | + submodules: 'true' |
| 41 | + |
| 42 | + - name: Setup workspace |
| 43 | + uses: ./.github/actions/setup-build |
| 44 | + |
| 45 | + - name: "Configuring MSVC" |
| 46 | + uses: ilammy/msvc-dev-cmd@v1.13.0 |
| 47 | + |
| 48 | + - name: Build torch-mlir |
| 49 | + run: | |
| 50 | + cd $GITHUB_WORKSPACE |
| 51 | + ./build_tools/python_deploy/build_windows_ci.sh |
| 52 | +
|
| 53 | + - name: Build Python wheels and smoke test |
| 54 | + run: | |
| 55 | + tm_package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')" |
| 56 | + echo "tm_package_version=${tm_package_version}" >> $GITHUB_ENV |
| 57 | + printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" ${tm_package_version} > ./torch_mlir_package_version |
| 58 | + pip install delvewheel |
| 59 | + TORCH_MLIR_PYTHON_PACKAGE_VERSION=${tm_package_version} TORCH_MLIR_CMAKE_BUILD_DIR="build" TORCH_MLIR_CMAKE_ALREADY_BUILT=1 python setup.py bdist_wheel |
| 60 | + delvewheel repair --add-path ./build/tools/torch-mlir/python_packages/torch_mlir/torch_mlir/_mlir_libs --add-dll TorchMLIRAggregateCAPI.dll --no-dll 'c10.dll;torch_python.dll;torch_cpu.dll' -v dist/torch_mlir*.whl -w dist |
| 61 | +
|
| 62 | + - name: Upload python wheels |
| 63 | + uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + if-no-files-found: error |
| 66 | + name: snapshot-${{ matrix.package }}-${{ matrix.py_version }}-${{ env.tm_package_version }} |
| 67 | + path: dist |
| 68 | + |
| 69 | + - name: Release python wheels |
| 70 | + uses: ncipollo/release-action@v1.14.0 |
| 71 | + with: |
| 72 | + artifacts: dist/*.whl |
| 73 | + token: "${{ secrets.GITHUB_TOKEN }}" |
| 74 | + tag: "dev-wheels" |
| 75 | + name: "dev-wheels" |
| 76 | + body: "Automatic snapshot release of torch-mlir python wheels." |
| 77 | + removeArtifacts: false |
| 78 | + allowUpdates: true |
| 79 | + replacesArtifacts: true |
| 80 | + makeLatest: true |
0 commit comments