Skip to content

[NO MERGE] Wheels

[NO MERGE] Wheels #10

Workflow file for this run

name: Distro
on:
workflow_dispatch:
inputs:
DEBUG_ENABLED:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
type: boolean
required: false
default: false
DEBUG_OS:
description: 'which runner os to run the tmate action in (if the tmate action is run)'
type: string
default: 'windows-2019'
required: false
DEBUG_ARCH:
description: 'which runner arch to run the tmate action in (if the tmate action is run)'
type: string
default: 'x86_64'
required: false
DEBUG_DETACHED:
description: 'whether to launch tmate in detached mode (if the tmate action is run)'
type: boolean
required: false
default: true
AIR_COMMIT:
description: 'which air commit to build'
type: string
required: false
default: ''
pull_request:
release:
types:
- published
jobs:
build_wheels:
name: ${{ matrix.OS }} ${{ matrix.ARCH }}
continue-on-error: true
runs-on: ${{ matrix.OS }}
strategy:
fail-fast: false
matrix:
include:
- OS: ubuntu-20.04
ARCH: x86_64
- OS: ubuntu-20.04
ARCH: aarch64
- OS: macos-11
ARCH: x86_64
- OS: macos-11
ARCH: arm64
# - OS: windows-2019
# ARCH: AMD64
steps:
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.DEBUG_ENABLED && inputs.DEBUG_OS == matrix.OS && inputs.DEBUG_ARCH == matrix.ARCH }}
with:
limit-access-to-actor: true
detached: ${{ inputs.DEBUG_DETACHED }}
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: Xilinx/mlir-air
ref: ${{ inputs.AIR_COMMIT != '' && inputs.AIR_COMMIT || 'main' }}
submodules: recursive
path: mlir-air
- uses: ilammy/[email protected]
if: ${{ matrix.OS == 'windows-2019' }}
- name: Set up Visual Studio shell
if: ${{ matrix.OS == 'windows-2019' }}
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: MS Build
if: ${{ matrix.OS == 'windows-2019' }}
uses: microsoft/[email protected]
- name: Free disk space
if: contains(matrix.OS, 'ubuntu')
uses: jlumbroso/free-disk-space@76866dbe54312617f00798d1762df7f43def6e5c # v1.2.0
with:
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false # This frees space on the wrong partition.
tool-cache: false # This includes Python, which we need.
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.OS }}-${{ matrix.ARCH }} # Make cache specific to OS
max-size: "5G"
- name: Configure ccache dir on host
id: configure_ccache_dir_on_host
if: ${{ matrix.OS == 'ubuntu-20.04' }}
run: |
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
mkdir -p $HOST_CCACHE_DIR
echo "HOST_CCACHE_DIR=$HOST_CCACHE_DIR" | tee -a $GITHUB_ENV
echo "HOST_CCACHE_DIR=$HOST_CCACHE_DIR" | tee -a $GITHUB_OUTPUT
- name: Configure ccache
if: ${{ matrix.OS == 'ubuntu-20.04' || matrix.OS == 'macos-11' }}
shell: bash
run: |
if [ x"${{ matrix.OS }}" == x"macos-11" ]; then
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
else
echo "/usr/lib/ccache:/usr/lib64/ccache:/usr/lib/ccache/bin" >> $GITHUB_PATH
fi
- name: Install Ninja
uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c # Jan 17
- name: Install cross-compilation toolchain
if: ${{ matrix.OS == 'ubuntu-20.04' && matrix.ARCH == 'aarch64' }}
run: |
sudo apt-get update
sudo apt-get install -y binutils-aarch64-linux-gnu \
g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
- name: set datetime
shell: bash
run: |
DATETIME=$(date +"%Y%m%d%H")
echo "DATETIME=${DATETIME}" | tee -a $GITHUB_ENV
# https://stackoverflow.com/a/73467112
- name: Split os
shell: bash
env:
OS: ${{ matrix.OS }}
id: split
run: echo "platform_version=${OS##*-}" | tee -a $GITHUB_OUTPUT
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
boost_version: 1.72.0
platform_version: ${{ steps.split.outputs.platform_version }}
arch: ${{ matrix.ARCH == 'x86_64' && 'x86' || 'aarch64' }}
- name: cibuildwheel
if: ${{ matrix.OS != 'ubuntu-20.04' || matrix.ARCH != 'aarch64' }}
shell: bash
run: |
pip install cibuildwheel
BOOST_ROOT="${{ steps.install-boost.outputs.BOOST_ROOT }}" \
CIBW_ARCHS=${{ matrix.ARCH }} \
CMAKE_GENERATOR="Ninja" \
HOST_CCACHE_DIR=${{ steps.configure_ccache_dir_on_host.outputs.HOST_CCACHE_DIR }} \
MATRIX_OS=${{ matrix.OS }} \
MLIR_WHEEL_VERSION="18.0.0.2023091015+780b046b" \
MLIR_AIE_WHEEL_VERSION="0.0.1.2023091105+a0cc3d0" \
PARALLEL_LEVEL=${{ matrix.OS == 'windows-2019' && '2' || '4' }} \
cibuildwheel --output-dir wheelhouse
- name: build aarch ubuntu wheel
shell: bash
if: ${{ matrix.OS == 'ubuntu-20.04' && matrix.ARCH == 'aarch64' }}
run: |
sudo apt-get install -y python3-dev
export PIP_NO_BUILD_ISOLATION="false"
export CIBW_ARCHS=${{ matrix.ARCH }}
export MLIR_WHEEL_VERSION="18.0.0.2023091015+780b046b"
export MLIR_AIE_WHEEL_VERSION="0.0.1.2023091105+a0cc3d0"
export BOOST_ROOT="${{ steps.install-boost.outputs.BOOST_ROOT }}"
export MATRIX_OS=${{ matrix.OS }}
pip install -r requirements.txt
./scripts/pip_install_mlir.sh
./scripts/pip_install_mlir_aie.sh
CMAKE_GENERATOR=Ninja \
pip wheel . -v -w wheelhouse --no-build-isolation \
-f https://makslevental.github.io/wheels \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels \
-f https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-wheels
- name: rename
shell: bash
if: ${{ matrix.OS == 'ubuntu-20.04' || matrix.OS == 'macos-11' }}
run: |
if [ x"${{ matrix.OS }}" == x"macos-11" ]; then
brew install rename
else
sudo apt-get install -y rename
fi
rename 's/cp310-cp310/py3-none/' wheelhouse/mlir_air-*whl
rename 's/cp311-cp311/py3-none/' wheelhouse/mlir_air-*whl
if [ x"${{ matrix.OS }}" == x"ubuntu-20.04" ] && [ x"${{ matrix.ARCH }}" == x"aarch64" ]; then
rename 's/x86_64/aarch64/' wheelhouse/mlir_air-*whl
fi
- name: rename
if: ${{ matrix.OS == 'windows-2019' }}
run: |
ls wheelhouse/mlir_air-*whl | Rename-Item -NewName {$_ -replace 'cp311-cp311', 'py3-none' }
- name: Download cache from container ubuntu
if: (matrix.OS == 'ubuntu-20.04' && matrix.ARCH == 'x86_64') && (success() || failure())
shell: bash
run: |
ccache -s
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
rm -rf $HOST_CCACHE_DIR
mv ./wheelhouse/.ccache $HOST_CCACHE_DIR
ls -la $HOST_CCACHE_DIR
ccache -s
- name: Upload wheels
if: success() || failure()
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
name: build_artifact
upload_distro_wheels:
name: Upload wheels
needs: [build_wheels]
runs-on: ubuntu-latest
# environment: pypi
# if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
contents: write
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: build_artifact
path: dist
- name: Release current commit
uses: ncipollo/[email protected]
with:
artifacts: "dist/*.whl,dist/*.tar.xz"
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "latest-wheels"
name: "latest-wheels"
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
call-build-python-bindings:
needs: [upload_distro_wheels]
uses: Xilinx/mlir-air/.github/workflows/wheels.yml@wheels_1
permissions:
contents: write
id-token: write
secrets: inherit # pass all secrets