Build Release Packages #487
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds packages for native (non cross-compiled) targets on supported | |
# platforms. | |
# | |
# For these mainline distributions, we use cibuildwheel and drive the | |
# packaging through python, extracting native assets. While this may seem | |
# hopelessly round-about, it lets us leverage a lot of what cibuildwheel | |
# does for free and get python packages to boot. | |
name: Build Native Release Packages | |
on: | |
workflow_dispatch: | |
inputs: | |
package_suffix: | |
description: "Suffix to append to package names" | |
required: false | |
default: "" | |
package_version: | |
description: "Version of the package" | |
required: true | |
default: "0.1a1" | |
release_id: | |
description: "Release id to upload artifacts to" | |
default: "" | |
commit: | |
description: "Commit to check out" | |
default: "" | |
jobs: | |
build_core: | |
name: "${{ matrix.build-family }} :: Build ${{ matrix.build-package }} Package" | |
runs-on: ${{ matrix.runs-on }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Ubuntu packages. | |
- runs-on: icelake | |
build-family: linux | |
build-package: py-compiler-pkg | |
experimental: false | |
- runs-on: icelake | |
build-family: linux | |
build-package: py-runtime-pkg | |
experimental: false | |
# Macos packages. | |
- runs-on: MacStudio | |
build-family: macos | |
build-package: py-compiler-pkg | |
experimental: true | |
- runs-on: MacStudio | |
build-family: macos | |
build-package: py-runtime-pkg | |
experimental: true | |
# Windows packages. | |
- runs-on: windows-latest | |
build-family: windows | |
build-package: py-compiler-pkg | |
experimental: true | |
# Linux AArch64 packages. | |
- runs-on: linux-aarch64 | |
build-family: linux-aarch64 | |
build-package: py-compiler-pkg | |
experimental: false | |
- runs-on: linux-aarch64 | |
build-family: linux-aarch64 | |
build-package: py-runtime-pkg | |
experimental: false | |
env: | |
MANYLINUX_X86_64_IMAGE: gcr.io/iree-oss/manylinux2014_x86_64-release@sha256:e83893d35be4ce3558c989e9d5ccc4ff88d058bc3e74a83181059cc76e2cf1f8 | |
MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64 | |
steps: | |
# Docker may leave root owned files | |
- name: Chown user | |
if: "matrix.build-family == 'linux-aarch64' || matrix.build-family == 'linux'" | |
run: | | |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | |
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | |
with: | |
path: "c" | |
submodules: true | |
ref: ${{ github.event.inputs.commit }} | |
- uses: actions/setup-python@v4 | |
if: "matrix.build-family == 'windows'" | |
with: | |
python-version: '3.11' | |
########################################################################## | |
# OS specific setup (Windows) | |
########################################################################## | |
- name: Install Windows VS Deps | |
if: "matrix.build-family == 'windows'" | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
########################################################################## | |
# Write version_info.json | |
# Various tools will read this in order to embed release information. | |
########################################################################## | |
- name: Write version info (release) | |
if: "matrix.build-family != 'windows'" | |
shell: bash | |
run: | | |
cat << EOF > ./c/version_info.json | |
{ | |
"package-suffix": "${{ github.event.inputs.package_suffix }}", | |
"package-version": "${{ github.event.inputs.package_version }}", | |
"iree-revision": "$(cd ./c && git rev-parse HEAD)" | |
} | |
EOF | |
cat ./c/version_info.json | |
########################################################################## | |
# Write Windows version_info.json | |
# Various tools will read this in order to embed release information. | |
########################################################################## | |
- name: Write version info (Windows release) | |
if: "matrix.build-family == 'windows'" | |
shell: powershell | |
run: | | |
cd ./c | |
./build_tools/python_deploy/create_version.ps1 -version ${{ github.event.inputs.package_version }} | |
more version_info.json | |
cd .. | |
########################################################################## | |
# py-runtime-pkg | |
# Builds the iree-runtime and iree-runtime-instrumented wheels. | |
# One step per OS. | |
########################################################################## | |
- name: Build runtime wheels (Linux-x86_64) | |
if: "matrix.build-package == 'py-runtime-pkg' && matrix.build-family == 'linux'" | |
shell: bash | |
env: | |
package_suffix: ${{ github.event.inputs.package_suffix }} | |
packages: "iree-runtime" | |
output_dir: "${{ github.workspace }}/bindist" | |
run: | | |
./c/build_tools/python_deploy/build_linux_packages.sh | |
- name: Build runtime wheels (Linux-AArch64) | |
if: "matrix.build-package == 'py-runtime-pkg' && matrix.build-family == 'linux-aarch64'" | |
shell: bash | |
env: | |
package_suffix: ${{ github.event.inputs.package_suffix }} | |
packages: "iree-runtime" | |
output_dir: "${{ github.workspace }}/bindist" | |
run: | | |
./c/build_tools/python_deploy/build_linux_packages.sh | |
- name: Build runtime wheels (MacOS) | |
if: "matrix.build-package == 'py-runtime-pkg' && matrix.build-family == 'macos'" | |
shell: bash | |
env: | |
package_suffix: ${{ github.event.inputs.package_suffix }} | |
packages: "iree-runtime" | |
output_dir: "${{ github.workspace }}/bindist" | |
override_python_versions: "3.11" | |
run: | | |
[ -e ./bindist/* ] && rm ./bindist/* | |
./c/build_tools/python_deploy/build_macos_packages.sh | |
########################################################################## | |
# py-compiler-pkg | |
# Builds the iree-compielr wheel. | |
# One step per OS. | |
########################################################################## | |
- name: Build compiler wheels (Linux) | |
if: "matrix.build-package == 'py-compiler-pkg' && matrix.build-family == 'linux'" | |
shell: bash | |
env: | |
package_suffix: ${{ github.event.inputs.package_suffix }} | |
packages: "iree-compiler" | |
output_dir: "${{ github.workspace }}/bindist" | |
run: | | |
./c/build_tools/python_deploy/build_linux_packages.sh | |
- name: Build compiler wheels (Linux-AArch64) | |
if: "matrix.build-package == 'py-compiler-pkg' && matrix.build-family == 'linux-aarch64'" | |
shell: bash | |
env: | |
package_suffix: ${{ github.event.inputs.package_suffix }} | |
packages: "iree-compiler" | |
output_dir: "${{ github.workspace }}/bindist" | |
run: | | |
./c/build_tools/python_deploy/build_linux_packages.sh | |
- name: Build compiler wheels (MacOS) | |
if: "matrix.build-package == 'py-compiler-pkg' && matrix.build-family == 'macos'" | |
shell: bash | |
env: | |
package_suffix: ${{ github.event.inputs.package_suffix }} | |
packages: "iree-compiler" | |
output_dir: "${{ github.workspace }}/bindist" | |
override_python_versions: "3.11" | |
run: | | |
[ -e ./bindist/* ] && rm ./bindist/* | |
./c/build_tools/python_deploy/build_macos_packages.sh | |
########################################################################## | |
# Build Windows packages. | |
########################################################################## | |
- name: Build Python wheels. | |
if: "matrix.build-family == 'windows'" | |
shell: powershell | |
run: | | |
cd c | |
./build_tools/python_deploy/build_windows.ps1 | |
########################################################################## | |
# TF Compiler Tools | |
# Compiler tools wheels are not python version specific, so just build | |
# for one examplar python version. | |
# TODO: This currently only builds on Linux and is hardcoded to do so. | |
########################################################################## | |
- name: Build TF Compiler Tools wheels | |
if: "matrix.build-package == 'py-tf-compiler-tools-pkg'" | |
shell: bash | |
run: | | |
docker run --rm -w=/work \ | |
-v $PWD:/work \ | |
"${MANYLINUX_X86_64_IMAGE}" \ | |
bash -c 'export PATH=/opt/python/cp39-cp39/bin:$PATH; python ./c/build_tools/github_actions/build_dist.py py-tf-compiler-tools-pkg' | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
# We upload all wheels (which includes deps so that subsequent | |
# steps can run without further fetching). | |
path: ./bindist/* | |
retention-days: 5 | |
# TODO: One Window Release builds we build both compiler+runtime | |
- name: Upload Release Assets (Windows) | |
if: "github.event.inputs.release_id != '' && matrix.build-family == 'windows'" | |
id: upload-release-assets-windows | |
uses: dwenegar/upload-release-assets@5bc3024cf83521df8ebfadf00ad0c4614fd59148 # v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }} | |
with: | |
release_id: ${{ github.event.inputs.release_id }} | |
# Only upload iree artifacts. | |
assets_path: ./bindist/iree*.* | |
# TODO: Upload the tar.bz2 files too when ready | |
- name: Upload Release Assets (Compiler) | |
if: "github.event.inputs.release_id != '' && matrix.build-package == 'py-compiler-pkg' && matrix.build-family != 'windows'" | |
id: upload-release-assets-compiler | |
uses: dwenegar/upload-release-assets@5bc3024cf83521df8ebfadf00ad0c4614fd59148 # v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }} | |
with: | |
release_id: ${{ github.event.inputs.release_id }} | |
# Only upload iree artifacts. | |
assets_path: ./bindist/iree_compiler*.* | |
- name: Upload Release Assets (Runtime) | |
if: "github.event.inputs.release_id != '' && matrix.build-package == 'py-runtime-pkg' && matrix.build-family != 'windows'" | |
id: upload-release-assets-runtime | |
uses: dwenegar/upload-release-assets@5bc3024cf83521df8ebfadf00ad0c4614fd59148 # v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }} | |
with: | |
release_id: ${{ github.event.inputs.release_id }} | |
# Only upload iree artifacts. | |
assets_path: ./bindist/iree_runtime*.* | |
validate_and_publish: | |
name: "Invoke workflow to validate and publish release" | |
needs: build_core | |
if: github.event.inputs.release_id != '' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: "Invoke workflow :: Validate and Publish Release" | |
uses: benc-uk/workflow-dispatch@798e70c97009500150087d30d9f11c5444830385 # v1.2.2 | |
with: | |
workflow: Validate and Publish Release | |
token: ${{ secrets.WRITE_ACCESS_TOKEN }} | |
ref: "${{ env.tag_name }}" | |
inputs: '{"release_id": "${{ github.event.inputs.release_id }}", "package_version": "${{ github.event.inputs.package_version }}", "build_run_id": "${{ github.run_id }}"}' |