[NO MERGE] Wheels #17
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
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: | |
- uses: makslevental/mlir-wheels/.github/actions/setup_base@main | |
id: setup_base | |
with: | |
# optional | |
DEBUG_ENABLED: ${{ inputs.DEBUG_ENABLED }} | |
DEBUG_OS: ${{ inputs.DEBUG_OS }} | |
DEBUG_ARCH: ${{ inputs.DEBUG_ARCH }} | |
DEBUG_DETACHED: ${{ inputs.DEBUG_DETACHED }} | |
# required | |
MATRIX_OS: ${{ matrix.OS }} | |
MATRIX_ARCH: ${{ matrix.ARCH }} | |
- uses: makslevental/mlir-wheels/.github/actions/setup_ccache@main | |
id: setup_ccache | |
with: | |
MATRIX_OS: ${{ matrix.OS }} | |
MATRIX_ARCH: ${{ matrix.ARCH }} | |
- name: Checkout | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
shell: bash | |
run: | | |
AIR_COMMIT=${{ inputs.AIR_COMMIT }} | |
git clone --recursive https://github.com/Xilinx/mlir-air.git | |
if [ x"$AIR_COMMIT" != x"" ]; then | |
pushd mlir-air && git reset --hard $AIR_COMMIT && popd | |
fi | |
# 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' }} | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
shell: bash | |
run: | | |
pip install cibuildwheel | |
export PIP_FIND_LINKS="https://makslevental.github.io/wheels https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-wheels" | |
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="17.0.0.2023092813+35ca6498" \ | |
MLIR_AIE_WHEEL_VERSION="0.0.1.2023102602+bdd3c4be" \ | |
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' }} | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
run: | | |
sudo apt-get install -y python3-dev | |
export PIP_FIND_LINKS="https://makslevental.github.io/wheels https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-wheels" | |
export PIP_NO_BUILD_ISOLATION="false" | |
export CIBW_ARCHS=${{ matrix.ARCH }} | |
export MLIR_WHEEL_VERSION="17.0.0.2023092813+35ca6498" | |
export MLIR_AIE_WHEEL_VERSION="0.0.1.2023102602+bdd3c4be" | |
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 | |
- name: Get wheel version | |
id: get_wheel_version | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
shell: bash | |
run: | | |
pip install pkginfo | |
WHL=$(ls wheelhouse/mlir_air-*whl) | |
echo "MLIR_AIR_WHEEL_VERSION=$(python -c "import pkginfo; print(pkginfo.Wheel('$WHL').version)")" | tee -a $GITHUB_OUTPUT | |
- 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/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' }} | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
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 | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
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: Reset datetime ccache | |
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} | |
shell: bash | |
run: | | |
ccache -s | |
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)" | |
find $HOST_CCACHE_DIR -exec touch -a -m -t "${{ needs.set_datetime.outputs.DATETIME }}00" {} \; | |
ccache -s | |
- name: Upload wheels | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}/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: [build_wheels, upload_distro_wheels] | |
uses: Xilinx/mlir-air/.github/workflows/wheels.yml@wheels_1 | |
permissions: | |
contents: write | |
id-token: write | |
secrets: inherit # pass all secrets | |
with: | |
MLIR_AIR_WHEEL_VERSION: ${{ needs.build_wheels.outputs.MLIR_AIE_WHEEL_VERSION }} |