Skip to content

Commit

Permalink
upgrade actions
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Oct 26, 2023
1 parent 4617c2b commit acf4c2c
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 167 deletions.
138 changes: 52 additions & 86 deletions .github/workflows/distro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,98 +58,39 @@ jobs:
- OS: macos-11
ARCH: arm64

- OS: windows-2019
ARCH: AMD64
# - 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 }}
- uses: makslevental/mlir-wheels/.github/actions/setup_base@main
id: setup_base
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(inputs.MATRIX_OS, 'ubuntu')
uses: descriptinc/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false # This frees space on the wrong partition.

- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: ccache
uses: hendrikmuhs/[email protected]
# 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:
key: ${{ github.job }}-${{ matrix.OS }}-${{ matrix.ARCH }} # Make cache specific to OS
max-size: "5G"
MATRIX_OS: ${{ matrix.OS }}
MATRIX_ARCH: ${{ matrix.ARCH }}

- 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' }}
- name: Checkout
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}
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
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
- 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
Expand All @@ -168,6 +109,7 @@ jobs:

- name: cibuildwheel
if: ${{ matrix.OS != 'ubuntu-20.04' || matrix.ARCH != 'aarch64' }}
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}
shell: bash
run: |
Expand All @@ -188,6 +130,7 @@ jobs:
- 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
Expand All @@ -207,6 +150,16 @@ jobs:
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' }}
Expand All @@ -217,20 +170,21 @@ jobs:
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' }}
working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}
run: |
ls wheelhouse/mlir_air-*whl | Rename-Item -NewName {$_ -replace 'cp311-cp311', 'py3-none' }
ls wheelhouse/mlir_air-*whl | Rename-Item -NewName {$_ -replace 'cp310-cp310', '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
Expand All @@ -240,11 +194,21 @@ jobs:
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: wheelhouse/*.whl
path: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}/wheelhouse/*.whl
name: build_artifact

upload_distro_wheels:
Expand Down Expand Up @@ -280,9 +244,11 @@ jobs:
makeLatest: true

call-build-python-bindings:
needs: [upload_distro_wheels]
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 }}
Loading

0 comments on commit acf4c2c

Please sign in to comment.