Skip to content

Release

Release #98

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
USE_LOCAL_VERSION:
description: 'use local version for wheel'
type: string
default: 1
BUNDLE_MLIR_PYTHON_BINDINGS:
description: 'bundle mlir python bindings'
type: string
default: 1
# release:
# types:
# - published
# push:
# branches:
# - main
# pull_request:
# paths:
# - .github/workflows/release.yml
concurrency:
group: ci-build-release-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
SYSTEM_VERSION_COMPAT: 0
PIP_FIND_LINKS: "https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-13, macos-14, windows-2022, ubuntu-22.04-arm ]
py_version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
gpu: [ "cuda", "amdgpu", "none" ]
exclude:
- os: macos-13
py_version: "3.9"
- os: macos-14
py_version: "3.9"
- os: macos-13
gpu: "cuda"
- os: macos-13
gpu: "amdgpu"
- os: macos-14
gpu: "cuda"
- os: macos-14
gpu: "amdgpu"
- os: windows-2022
gpu: "cuda"
- os: windows-2022
gpu: "amdgpu"
- os: ubuntu-22.04-arm
gpu: "cuda"
- os: ubuntu-22.04-arm
gpu: "amdgpu"
name: Release "${{ matrix.os }}-${{ matrix.py_version }} ${{ matrix.gpu != 'none' && matrix.gpu || '' }}"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py_version }}
allow-prereleases: true
- name: Get bindings metadata
shell: bash
run: |
echo "BINDINGS_VERSION=$(python scripts/get_latest_bindings.py ${{ matrix.gpu }})" >> $GITHUB_ENV
echo "BUNDLE_MLIR_PYTHON_BINDINGS=${{ inputs.BUNDLE_MLIR_PYTHON_BINDINGS != '' && inputs.BUNDLE_MLIR_PYTHON_BINDINGS || 1 }}" >> $GITHUB_ENV
echo "USE_LOCAL_VERSION=${{ inputs.USE_LOCAL_VERSION != '' && inputs.USE_LOCAL_VERSION || 1 }}" >> $GITHUB_ENV
echo "PLAT=$(python scripts/get_latest_bindings.py ${{ matrix.gpu }} --only-plat)" >> $GITHUB_ENV
echo "GPU=${{ matrix.gpu }}" >> $GITHUB_ENV
- name: Build wheel
shell: bash
run: |
if [ "$BUNDLE_MLIR_PYTHON_BINDINGS" == "1" ]; then
pip install mlir-python-bindings==$BINDINGS_VERSION -t tmp
cp -R tmp/mlir $PWD
fi
pip wheel . -v -w wheelhouse
- name: auditwheel
if: (startsWith(matrix.os, 'ubuntu') && env.BUNDLE_MLIR_PYTHON_BINDINGS == '1')
shell: bash
run: |
pip install auditwheel
mv wheelhouse/mlir_python_extras-*.whl $PWD
auditwheel repair mlir_python_extras-*.whl -w wheelhouse --plat $PLAT --exclude libmlir_float16_utils* --exclude libcuda*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
path: wheelhouse/mlir_python_extras-*.whl
name: build_artifact-${{ matrix.os }}-${{ matrix.py_version }}-${{ matrix.gpu }}
upload_bindings_wheels:
if: github.event_name != 'pull_request'
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: build_artifact-*
path: dist
merge-multiple: true
- name: Release current commit
uses: ncipollo/[email protected]
with:
artifacts: "dist/*.whl"
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "latest"
name: "latest"
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
artifactErrorsFailBuild: true
- name: Release current commit
uses: ncipollo/[email protected]
with:
owner: makslevental
repo: wheels
artifacts: "dist/*.whl"
token: "${{ secrets.WHEELS_REPO }}"
tag: "i"
name: "i"
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
artifactErrorsFailBuild: true
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
name: build_artifact-sdist