Skip to content

Commit 9f09562

Browse files
committed
add wheels
1 parent a40433d commit 9f09562

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ jobs:
3838
pip install .[torch-mlir-test] \
3939
-f https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest \
4040
-f https://llvm.github.io/torch-mlir/package-index/
41-
pushd /tmp && python -m mlir_utils._configuration -y torch_mlir && popd
41+
if [ ${{ matrix.os }} == 'windows-2022' ]; then
42+
# configure-mlir-utils.exe -y torch_mlir
43+
pushd /tmp && python -m mlir_utils._configuration -y torch_mlir && popd
44+
else
45+
configure-mlir-utils -y torch_mlir
46+
fi
4247
4348
- name: Test
4449
shell: bash

.github/workflows/wheels.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Wheels
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build_wheels:
11+
runs-on: ubuntu-20.04
12+
outputs:
13+
VERSION: ${{ steps.build_wheel.outputs.version }}
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Build wheel
22+
id: build_wheel
23+
run: |
24+
pip wheel -w wheelhouse .
25+
pip install toml
26+
VERSION="$(python -c 'import toml; print(toml.load("pyproject.toml")["project"]["version"])')"
27+
echo "version=${VERSION}" | tee -a $GITHUB_OUTPUT
28+
29+
- name: Upload wheels
30+
uses: actions/upload-artifact@v3
31+
with:
32+
path: wheelhouse/*.whl
33+
name: build_artifact
34+
35+
upload_wheels:
36+
37+
name: Upload wheels
38+
39+
needs: [build_wheels]
40+
41+
runs-on: ubuntu-latest
42+
permissions:
43+
id-token: write
44+
contents: write
45+
steps:
46+
- uses: actions/download-artifact@v3
47+
with:
48+
# unpacks default artifact into dist/
49+
# if `name: artifact` is omitted, the action will create extra parent dir
50+
name: build_artifact
51+
path: dist
52+
53+
- name: Set up a release page
54+
id: setup_release
55+
run: |
56+
VERSION=${{ needs.build_wheels.outputs.version }}
57+
echo "`mlir-python-utils` $VERSION distribution created at $(date)" > body.md
58+
echo "tag_name=${VERSION}" | tee -a $GITHUB_OUTPUT
59+
echo "release_title=mlir-python-utils-${VERSION}" | tee -a $GITHUB_OUTPUT
60+
61+
- name: Release current commit
62+
uses: ncipollo/[email protected]
63+
with:
64+
artifacts: "dist/*.whl"
65+
bodyFile: body.md
66+
token: "${{ secrets.GITHUB_TOKEN }}"
67+
tag: "${{ steps.setup_release.outputs.tag_name }}"
68+
name: "${{ steps.setup_release.outputs.release_title }}"
69+
removeArtifacts: false
70+
allowUpdates: true
71+
replacesArtifacts: true
72+
makeLatest: true

mlir_utils/_configuration/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def alias_upstream_bindings():
6060
)
6161
elif not (
6262
sys.argv[0].endswith("configure-mlir-utils")
63-
or ("-m" in sys.orig_argv and "mlir_utils.__configuration" in sys.orig_argv)
63+
or ("-m" in sys.orig_argv and __package__ in sys.orig_argv)
6464
):
6565
raise Exception(
6666
"mlir-utils not configured and MLIR_PYTHON_PACKAGE_PREFIX env variable not set"

0 commit comments

Comments
 (0)