Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push-button release workflow #133

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Release

on:
push:
branches:
- release_workflow
workflow_dispatch:
inputs:
publish:
type: boolean
description: send packages to PyPi and the tlcpack wheels list

jobs:
linux-pypi:
strategy:
fail-fast: false
matrix:
# matrix of build configs
config:
- cuda: 'none'
image: 'tlcpack/package-cpu:0b3b4c9'
package_name: 'apache-tvm'
- cuda: '10.2'
image: 'tlcpack/package-cu102:0b3b4c9'
package_name: 'apache-tvm-cu102'
- cuda: '11.3'
image: 'tlcpack/package-cu113:0b3b4c9'
package_name: 'apache-tvm-cu113'
- cuda: '11.6'
image: 'tlcpack/package-cu116:0b3b4c9'
package_name: 'apache-tvm-cu116'

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: TVM checkout
run: |
set -eux
git clone https://github.com/apache/tvm tvm --recursive
- name: Sync package
run: |
set -euxo pipefail
python3 common/sync_package.py \
--cuda ${{ matrix.config.cuda }} \
--package-name ${{ matrix.config.package_name }} \
--use-public-version \
pypi
cd tvm
- name: Build wheel
env:
IMAGE: ${{ matrix.config.image }}
CUDA: ${{ matrix.config.cuda }}
run: |
set -eux
docker/bash.sh --no-gpu $IMAGE ./wheel/build_wheel_manylinux.sh --cuda $CUDA
- name: Test
if: matrix.config.cuda == 'none'
env:
IMAGE: ${{ matrix.config.image }}
WHEEL_TEST: "True"
run: |
set -eux
docker/bash.sh --no-gpu $IMAGE ./wheel/run_tests.sh
- uses: actions/upload-artifact@v3
with:
name: linux-wheel-${{ matrix.config.package_name }}-${{ matrix.config.cuda }}
path: tvm/python/repaired_wheels
- name: Upload to PyPi
if: ${{ matrix.config.cuda == 'none' && github.event.inputs.publish }}
env:
TWINE_NON_INTERACTIVE: 1
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
run: |
set -eux
python3 -m pip install twine
twine upload tvm/python/repaired_wheels/*
- name: Upload to tlcpack wheels
if: ${{ github.event.inputs.publish }}
env:
GITHUB_TOKEN: ${{ secrets.TLCPACK_GITHUB_TOKEN }}
run: |
set -eux
python3 -m pip install github3.py
python3 wheel/wheel_upload.py --tag v0.7.dev1 tvm/python/repaired_wheels
pypi-cpu:
strategy:
fail-fast: false
matrix:
# matrix of build configs
os:
- macOS-latest
# - windows-latest
python_version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: tlcpack-build
channel-priority: strict
environment-file: conda/build-environment.yaml
auto-activate-base: false
use-only-tar-bz2: true
python-version: ${{ matrix.python_version }}
- name: Conda info
shell: bash -l {0}
run: |
conda info
conda list
- name: TVM checkout
run: |
git clone https://github.com/apache/tvm tvm --recursive
- name: Sync Package
shell: bash -l {0}
run: |
python3 common/sync_package.py --package-name apache-tvm --use-public-version pypi
- name: Build (MacOS)
shell: bash -l {0}
if: startsWith(matrix.os, 'macOS')
run: |
wheel/build_lib_osx.sh
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
shell: cmd /C call {0}
run: >-
wheel/build_lib_win.bat
- name: Build wheel
shell: bash -l {0}
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
run: |
python -m pip install setuptools Cython wheel
cd tvm/python
python setup.py bdist_wheel
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-release-wheels-${{ matrix.python_version }}
path: tvm/python/dist/
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-release-build-${{ matrix.python_version }}
path: tvm/python/build/
- name: Upload to tlcpack wheels
if: ${{ github.event.inputs.publish }}
env:
GITHUB_TOKEN: ${{ secrets.TLCPACK_GITHUB_TOKEN }}
run: |
set -eux
python3 -m pip install github3.py
python3 wheel/wheel_upload.py --tag v0.7.dev1 tvm/python/dist
2 changes: 1 addition & 1 deletion conda/build-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- conda-build
- anaconda-client
- git
- llvmdev ==10.0.0
- llvmdev==10.0.0
- numpy
- pytest
- cmake
Expand Down
6 changes: 3 additions & 3 deletions wheel/build_lib_osx.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

set -e
set -u
set -eux

cd tvm
rm -f config.cmake
Expand All @@ -23,9 +22,10 @@ cmake -DCMAKE_BUILD_TYPE=Release \
-DUSE_ETHOSU=ON \
-DUSE_CMSISNN=ON \
-DUSE_MICRO=ON \
-DSUMMARIZE=ON \
-DUSE_MICRO_STANDALONE_RUNTIME=ON \
-DUSE_METAL=ON \
..

make -j3
make -j2
cd ../..
1 change: 1 addition & 0 deletions wheel/build_lib_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cmake -A x64 -Thost=x64 ^
-DUSE_RPC=ON ^
-DUSE_SORT=ON ^
-DUSE_RANDOM=ON ^
-DSUMMARIZE=ON ^
-DUSE_GRAPH_RUNTIME_DEBUG=ON ^
..

Expand Down
38 changes: 26 additions & 12 deletions wheel/build_wheel_manylinux.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#!/usr/bin/env bash

set -exo pipefail

source /multibuild/manylinux_utils.sh

TVM_PYTHON_DIR="/workspace/tvm/python"
PYTHON_VERSIONS=$(conda env list | grep py | awk '{print $1}' | tr -d py3 | xargs -I {} printf "3.{}\n" | sort -V)
PYTHON_VERSIONS_CPU=$PYTHON_VERSIONS
PYTHON_VERSIONS_GPU=$PYTHON_VERSIONS
CUDA_OPTIONS=("none" "10.2" "11.1" "11.3" "11.6")


function activate() {
eval "$(conda shell.bash hook)"
PYTHON_VERSION=$1
ENV_NAME=$(echo "$PYTHON_VERSION" | tr -d 3. | xargs -I {} printf "py3{}\n")
conda activate "$ENV_NAME"
}


function usage() {
echo "Usage: $0 [--cuda CUDA]"
echo
echo -e "--cuda {none 10.2 11.1 11.3 11.6}"
echo -e "--cuda" "${CUDA_OPTIONS[@]}"
echo -e "\tSpecify the CUDA version in the TVM (default: none)."
}

Expand Down Expand Up @@ -36,11 +53,6 @@ function audit_tlcpack_wheel() {
auditwheel repair ${AUDITWHEEL_OPTS} dist/*cp${python_version_str}*.whl
}

TVM_PYTHON_DIR="/workspace/tvm/python"
PYTHON_VERSIONS_CPU=("3.7" "3.8" "3.9" "3.10")
PYTHON_VERSIONS_GPU=("3.7" "3.8")
CUDA_OPTIONS=("none" "10.2" "11.1" "11.3" "11.6")
CUDA="none"

while [[ $# -gt 0 ]]; do
arg="$1"
Expand All @@ -52,22 +64,23 @@ while [[ $# -gt 0 ]]; do
;;
-h|--help)
usage
exit -1
exit 1
;;
*) # unknown option
echo "Unknown argument: $arg"
echo
usage
exit -1
exit 1
;;
esac
done


if ! in_array "${CUDA}" "${CUDA_OPTIONS[*]}" ; then
echo "Invalid CUDA option: ${CUDA}"
echo
echo 'CUDA can only be {"none", "10.2", "11.1", "11.3", "11.6"}'
exit -1
echo 'CUDA can only be ' "${CUDA_OPTIONS[@]}"
exit 1
fi

if [[ ${CUDA} == "none" ]]; then
Expand Down Expand Up @@ -95,6 +108,7 @@ echo set\(USE_ARM_COMPUTE_LIB /opt/arm/acl\) >> config.cmake
echo set\(USE_MICRO ON\) >> config.cmake
echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake
echo set\(USE_ETHOSU ON\) >> config.cmake
echo set\(SUMMARIZE ON\) >> config.cmake
echo set\(USE_CMSISNN ON\) >> config.cmake
if [[ ${CUDA} != "none" ]]; then
echo set\(USE_CUDA ON\) >> config.cmake
Expand All @@ -106,14 +120,15 @@ fi
mkdir -p build
cd build
cmake ..
make -j$(nproc)
make -j"$(nproc)"

UNICODE_WIDTH=32 # Dummy value, irrelevant for Python 3

# Not all manylinux Docker images will have all Python versions,
# so check the existing python versions before generating packages
for python_version in ${PYTHON_VERSIONS[*]}
do
activate "$python_version"
echo "> Looking for Python ${python_version}."

# Remove the . in version string, e.g. "3.8" turns into "38"
Expand All @@ -128,6 +143,5 @@ do
else
echo "Python ${python_version} not found. Skipping.";
fi

done

3 changes: 3 additions & 0 deletions wheel/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

cd /workspace/tvm

source /opt/conda/bin/activate
conda activate py37
pip install psutil pytest-xdist
bash tests/scripts/task_python_unittest.sh