Skip to content

Commit e294109

Browse files
authored
Add support for releasing windows wheels. (#2)
This PR adds support for windows nightly build for releasing `torch-mlir` python wheels following the work done for linux. Here's the job for the windows build: https://github.com/sahas3/torch-mlir-release/actions/runs/11425775316
1 parent e8002a1 commit e294109

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This repository houses release automation for torch-mlir. It is isolated from the main repository
44
so that we can more strictly control people with write access.
55

6-
### Python Releases (x86 linux)
6+
### Python Releases (x86 linux and windows)
77
Python wheels for torch-mlir are auto-generated every night and made available at [this release page](https://github.com/llvm/torch-mlir-release/releases/tag/dev-wheels).
88

99
To install via `pip`, run:
@@ -18,4 +18,4 @@ or add this to `requirements.txt`:
1818
torch-mlir
1919
```
2020

21-
At the moment only linux-x86_64 builds are published, but this may be updated if the need arises (and we find appropriate owners to maintain the automation).
21+
At the moment only linux and windows x86_64 builds are published, but this may be updated if the need arises (and we find appropriate owners to maintain the automation).

0 commit comments

Comments
 (0)