Skip to content

Commit

Permalink
Publish releases to PyPI after build
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis23 authored Dec 7, 2022
1 parent c956c39 commit 98d80a6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 5 deletions.
63 changes: 61 additions & 2 deletions .github/workflows/buildRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ jobs:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
release_id: ${{ github.event.inputs.release_id }}
- name: Create dist directory
if: github.event.inputs.release_id != ''
run: mkdir dist
- name: Copy releases to publish to dist directory
if: github.event.inputs.release_id != ''
run: cp build_tools/python_deploy/wheelhouse/torch_mlir-*.whl dist/

# Wheels must be published from a linux environment.
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

build_macos:
name: MacOS Build
Expand Down Expand Up @@ -93,8 +108,22 @@ jobs:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
release_id: ${{ github.event.inputs.release_id }}


- name: Create dist directory
if: github.event.inputs.release_id != ''
run: mkdir dist
- name: Copy releases to publish to dist directory
if: github.event.inputs.release_id != ''
run: cp build_tools/python_deploy/wheelhouse/torch_mlir-*.whl dist/

# Wheels must be published from a linux environment.
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

build_windows:
name: Windows Build
runs-on: windows-latest
Expand Down Expand Up @@ -137,6 +166,22 @@ jobs:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
with:
release_id: ${{ github.event.inputs.release_id }}
- name: Create dist directory
if: github.event.inputs.release_id != ''
run: mkdir dist
continue-on-error: true
- name: Copy releases to publish to dist directory
if: github.event.inputs.release_id != ''
run: cp ./wheelhouse/torch_mlir-*.whl dist/

# Wheels must be published from a linux environment.
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Store the binary wheel
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

publish_releases:
runs-on: ubuntu-latest
Expand All @@ -154,3 +199,17 @@ jobs:
with:
workflow: Publish releases page
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

# Wheels must be published from a linux environment.
#
# See https://github.com/pypa/gh-action-pypi-publish/discussions/15
- name: Download wheels for publishing to PyPI
uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Publish to PyPI
if: github.event.inputs.release_id != ''
uses: pypa/gh-action-pypi-publish@v1.5.1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions build_tools/python_deploy/build_linux_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function run_in_docker() {
torch-mlir)
clean_wheels torch_mlir "$python_version"
build_torch_mlir
#run_audit_wheel torch_mlir "$python_version"
run_audit_wheel torch_mlir "$python_version"
clean_build torch_mlir "$python_version"
;;
out-of-tree)
Expand Down Expand Up @@ -365,7 +365,7 @@ function build_torch_mlir() {
function run_audit_wheel() {
local wheel_basename="$1"
local python_version="$2"
generic_wheel="/wheelhouse/${wheel_basename}-*-${python_version}-linux_x86_64.whl"
generic_wheel="/wheelhouse/${wheel_basename}-${TORCH_MLIR_PYTHON_PACKAGE_VERSION}-${python_version}-linux_x86_64.whl"
echo ":::: Auditwheel $generic_wheel"
auditwheel repair -w /wheelhouse "$generic_wheel"
rm "$generic_wheel"
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,18 @@ def build_extension(self, ext):
pass


with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()


setup(
name="torch-mlir",
version=f"{PACKAGE_VERSION}",
author="Sean Silva",
author_email="silvasean@google.com",
description="First-class interop between PyTorch and MLIR",
long_description="",
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
cmdclass={
"build": CustomBuild,
Expand Down

0 comments on commit 98d80a6

Please sign in to comment.