microsoft/onnxruntime-extensions

Public

mirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.4.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/scripts/wheelbuilder.sh

51lines · modecode

1#!/bin/bash
2
3set -e -x -u
4
5# CLI arguments
6PY_VERSION=$1
7PLAT=$2
8GITHUB_EVENT_NAME=$3
9BUILD_REQUIREMENTS='numpy>=1.18.5 wheel'
10
11PY_VER="cp${PY_VERSION//./}-cp${PY_VERSION//./}"
12if [ ! -d "/opt/python/${PY_VER}" ]
13then
14 PY_VER="${PY_VER}m"
15fi
16
17export PATH=/opt/python/${PY_VER}/bin:$PATH
18
19# Update pip
20pip install --upgrade --no-cache-dir pip
21
22# Check if requirements were passed
23if [ ! -z "$BUILD_REQUIREMENTS" ]; then
24 pip install --no-cache-dir ${BUILD_REQUIREMENTS} || { echo "Installing requirements failed."; exit 1; }
25fi
26
27# Build wheels
28if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then
29 python setup.py bdist_wheel --nightly_build || { echo "Building wheels failed."; exit 1; }
30else
31 python setup.py bdist_wheel || { echo "Building wheels failed."; exit 1; }
32fi
33
34
35# Bundle external shared libraries into the wheels
36# find -exec does not preserve failed exit codes, so use an output file for failures
37failed_wheels=$PWD/failed-wheels
38rm -f "$failed_wheels"
39find . -type f -iname "*-linux*.whl" -exec sh -c "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> "$failed_wheels"; }" \;
40
41if [[ -f "$failed_wheels" ]]; then
42 echo "Repairing wheels failed:"
43 cat failed-wheels
44 exit 1
45fi
46
47# Remove useless *-linux*.whl; only keep manylinux*.whl
48rm -f dist/*-linux*.whl
49
50echo "Succesfully build wheels:"
51find . -type f -iname "*manylinux*.whl"