diff --git a/.github/workflows/release_linux_aarch64.yml b/.github/workflows/release_linux_aarch64.yml index c59cc4dfa..578c1e663 100644 --- a/.github/workflows/release_linux_aarch64.yml +++ b/.github/workflows/release_linux_aarch64.yml @@ -14,7 +14,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] + # python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: [ '3.8'] architecture: [ 'x64' ] steps: diff --git a/.github/workflows/release_linux_x86_64.yml b/.github/workflows/release_linux_x86_64.yml index 88fae4f7e..511c4b278 100644 --- a/.github/workflows/release_linux_x86_64.yml +++ b/.github/workflows/release_linux_x86_64.yml @@ -1,40 +1,40 @@ -# name: LinuxRelease_x86_64 +name: LinuxRelease_x86_64 -# on: -# release: -# types: [published] +on: + release: + types: [published] -# permissions: -# contents: read +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' ] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] + architecture: [ 'x64' ] -# steps: -# # Checkout the latest branch of Paddle2ONNX. -# - name: Checkout Paddle2ONNX -# uses: actions/checkout@v4 -# with: -# submodules: true + 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 + - 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 + - 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 }} \ No newline at end of file + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.ZHENG_BICHENG_PYPI_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/scripts/build_protobuf_unix.sh b/.github/workflows/scripts/build_protobuf_unix.sh deleted file mode 100644 index 85fb09c98..000000000 --- a/.github/workflows/scripts/build_protobuf_unix.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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 \ No newline at end of file diff --git a/.github/workflows/scripts/download_protobuf.sh b/.github/workflows/scripts/download_protobuf.sh new file mode 100644 index 000000000..d480a422c --- /dev/null +++ b/.github/workflows/scripts/download_protobuf.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Detect the operating system +OS=$(uname -s) +ARCH=$(uname -m) + +# Check if the operating system is Linux +if [ "$OS" = "Linux" ]; then + if [[ "$ARCH" == "x86_64" ]]; then + protobuf_tgz_name="protobuf-linux-x64-3.16.0.tgz" + elif [[ "$ARCH" == "arm"* || "$ARCH" == "aarch64" ]]; then + protobuf_tgz_name="protobuf-linux-aarch64-3.16.0.tgz" + else + echo "When the operating system is Linux, the system architecture only supports (x86_64 and aarch64), but the current architecture is $ARCH." + exit 1 + fi +# Check if the operating system is Darwin (macOS) +elif [ "$OS" = "Darwin" ]; then + if [[ "$ARCH" == "x86_64" ]]; then + protobuf_tgz_name="protobuf-osx-x86_64-3.16.0.tgz" + elif [[ "$ARCH" == "arm64" ]]; then + protobuf_tgz_name="protobuf-osx-arm64-3.16.0.tgz" + else + echo "When the operating system is Darwin, the system architecture only supports (x86_64 and arm64), but the current architecture is $ARCH." + exit 1 + fi +else + echo "The system only supports (Linux and Darwin), but the current system is $OS." +fi + +protobuf_url="https://bj.bcebos.com/fastdeploy/third_libs/$protobuf_tgz_name" +wget $protobuf_url +protobuf_svae_dir="$PWD/installed_protobuf" +mkdir -p $protobuf_svae_dir +tar -zxf $protobuf_tgz_name -C $protobuf_svae_dir +export PATH=$protobuf_svae_dir/bin:${PATH} \ No newline at end of file diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index 0a920e56f..299eee3b5 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -25,7 +25,7 @@ $PIP_INSTALL_COMMAND --upgrade pip $PIP_INSTALL_COMMAND cmake # Build protobuf from source -source .github/workflows/scripts/build_protobuf_unix.sh "$(nproc)" +source .github/workflows/scripts/download_protobuf.sh # Build Paddle2ONNX wheels $PYTHON_COMMAND -m build --wheel || { echo "Building wheels failed."; exit 1; } diff --git a/.gitignore b/.gitignore index 05c8a3f98..657cfb98a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,22 @@ +# System-generated temporary files .DS_Store -*~ +# Temporary files that may be generated when loading Paddle2ONNX using an IDE +.idea +.vscode -*.pyc -.pydevproject -.eggs/* -dist/* -.setuptools* -paddle2onnx.egg-info/* -*.pdmodel -*_*.onnx -*.log +# Files that change dynamically when compiling Paddle2ONNX version.py paddle2onnx/mappers_registry.h -# CMD -build/* -paddle2onnx-* - -# Clion +# Temporary files that may be generated when building Paddle2ONNX +protobuf-* +installed_protobuf +build cmake-build-* -.idea +paddle2onnx.egg-info/* +dist/* -# VSCode -.vscode \ No newline at end of file +# Temporary files automatically generated when executing Paddle2ONNX unit tests +*.pdmodel +*.onnx \ No newline at end of file