-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI][Update] Update CI Actions for releasing a brand new release pack…
…age. (#1219) * Add compilation script for protobuf * Add Docker compilation script for paddle2onnx * Upgrade version is good * Support automatic building and uploading of Python packages during release version publication
- Loading branch information
1 parent
b32b7ba
commit 83ecf73
Showing
10 changed files
with
155 additions
and
27 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] | ||
architecture: [ 'x64' ] | ||
|
||
# For the sake of simplicity in testing, the Paddle2ONNX packaging program will temporarily only package executable files for Python 3.8. | ||
# In the future, we will need to extend support to cover Python 3.8 through Python 3.10. | ||
steps: | ||
# Checkout the latest branch of Paddle2ONNX. | ||
- name: Checkout Paddle2ONNX | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Build on manylinux2014_x86_64 | ||
uses: docker://quay.io/pypa/manylinux2014_x86_64:latest | ||
with: | ||
entrypoint: bash | ||
args: .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} manylinux2014_x86_64 | ||
|
||
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.ZHENG_BICHENG_PYPI_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) ONNX Project Contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
export CORE_NUMBER=$1 | ||
|
||
if [[ -z "$CORE_NUMBER" ]]; then | ||
export CORE_NUMBER=1 | ||
fi | ||
|
||
# Build protobuf from source with -fPIC on Unix-like system | ||
ORIGINAL_PATH=$(pwd) | ||
cd .. | ||
git clone https://github.com/protocolbuffers/protobuf.git -b v3.16.0 | ||
cd protobuf | ||
mkdir build_source && cd build_source | ||
cmake ../cmake -DCMAKE_INSTALL_PREFIX=${PWD}/installed_protobuf_lib -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release | ||
make -j$CORE_NUMBER && make install | ||
export PATH=${PWD}/installed_protobuf_lib/bin:${PATH} | ||
cd $ORIGINAL_PATH |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) ONNX Project Contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e -x | ||
|
||
# CLI arguments | ||
PY_VERSION=$1 | ||
PLAT=$2 | ||
GITHUB_EVENT_NAME=$3 | ||
|
||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib | ||
|
||
# Compile wheels | ||
# Need to be updated if there is a new Python Version | ||
if [ "$(uname -m)" == "aarch64" ]; then | ||
PIP_INSTALL_COMMAND="$PY_VERSION -m pip install --no-cache-dir -q" | ||
PYTHON_COMMAND="$PY_VERSION" | ||
else | ||
declare -A python_map=( ["3.8"]="cp38-cp38" ["3.9"]="cp39-cp39" ["3.10"]="cp310-cp310" ["3.11"]="cp311-cp311" ["3.12"]="cp312-cp312") | ||
PY_VER=${python_map[$PY_VERSION]} | ||
PIP_INSTALL_COMMAND="/opt/python/${PY_VER}/bin/pip install --no-cache-dir -q" | ||
PYTHON_COMMAND="/opt/python/${PY_VER}/bin/python" | ||
fi | ||
|
||
# Update pip and install cmake | ||
$PIP_INSTALL_COMMAND --upgrade pip | ||
$PIP_INSTALL_COMMAND cmake | ||
|
||
# Build protobuf from source | ||
source .github/workflows/scripts/build_protobuf_unix.sh "$(nproc)" | ||
|
||
# Build Paddle2ONNX wheels | ||
$PYTHON_COMMAND -m build --wheel || { echo "Building wheels failed."; exit 1; } | ||
|
||
# Bundle external shared libraries into the wheels | ||
# find -exec does not preserve failed exit codes, so use an output file for failures | ||
failed_wheels=$PWD/failed-wheels | ||
rm -f "$failed_wheels" | ||
find . -type f -iname "*-linux*.whl" -exec sh -c "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> '$failed_wheels'; }" \; | ||
|
||
if [[ -f "$failed_wheels" ]]; then | ||
echo "Repairing wheels failed:" | ||
cat failed-wheels | ||
exit 1 | ||
fi | ||
|
||
# Remove useless *-linux*.whl; only keep manylinux*.whl | ||
rm -f dist/*-linux*.whl | ||
|
||
echo "Successfully build wheels:" | ||
find . -type f -iname "*manylinux*.whl" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.1.0 | ||
1.2.0 |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Docker编译安装Paddle2ONNX | ||
|
||
Paddle2ONNX编译安装需要确保环境满足以下需求 | ||
- cmake >= 3.18.0 | ||
- protobuf == 3.16.0 | ||
|
||
注意:Paddle2ONNX产出的模型,在使用ONNX Runtime推理时,要求使用最新版本(1.10.0版本以及上),如若需要使用低版本(1.6~1.10之间),则需要将ONNX版本降至1.8.2,在执行完`git submodule update`后,执行如下命令,然后再进行编译 | ||
``` | ||
cd Paddle2ONNX/third/onnx | ||
git checkout v1.8.1 | ||
``` | ||
|
||
拉取manylinux镜像并创建容器 | ||
|
||
```bash | ||
docker pull quay.io/pypa/manylinux2014_x86_64 | ||
docker run --name p2o_build -d quay.io/pypa/manylinux2014_x86_64 | ||
``` | ||
|
||
创建容器并运行 | ||
|
||
```bash | ||
docker start p2o_build | ||
docker exec -it p2o_build bash | ||
``` | ||
|
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
Empty file.