From d31ea8cc9bff6c9c098fd5375972409558049903 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 22:07:51 +0800 Subject: [PATCH 01/17] test build on macos-latest --- .github/workflows/build_and_test.yml | 42 +++++++++++++++++-- .../workflows/scripts/download_protobuf.sh | 8 ++-- .github/workflows/scripts/entrypoint.sh | 12 ++++-- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 60329d490..1169b4f60 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -2,9 +2,9 @@ name: Build and Test on: push: - branches: [ "develop" ] + branches: [ "release_mac" ] pull_request: - branches: [ "develop" ] + branches: [ "release_mac" ] permissions: contents: read @@ -94,4 +94,40 @@ jobs: - name: Run Test working-directory: ./tests run: | - .\run.bat python \ No newline at end of file + .\run.bat python + + build_on_macos: + runs-on: macos-latest + strategy: + matrix: + python-version: [ '3.8'] + architecture: [ 'arm64' ] + + steps: + # Checkout the latest branch of Paddle2ONNX. + - name: Checkout Paddle2ONNX + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build on macos + uses: docker://quay.io/pypa/manylinux2014_x86_64:latest + with: + entrypoint: bash + args: .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} ${{ matrix.architecture }} Darwin + + - name: Setup Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: '3.8' + + # Install Paddle2ONNX + - name: Install Paddle2ONNX + run: | + python -m pip install dist/*.whl + + # Install Test + - name: Run Test + working-directory: ./tests + run: | + bash run.sh python \ No newline at end of file diff --git a/.github/workflows/scripts/download_protobuf.sh b/.github/workflows/scripts/download_protobuf.sh index 1d00c9769..9f94d3765 100644 --- a/.github/workflows/scripts/download_protobuf.sh +++ b/.github/workflows/scripts/download_protobuf.sh @@ -31,7 +31,7 @@ else fi 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 +protobuf_save_dir="$PWD/installed_protobuf" +mkdir -p $protobuf_save_dir +tar -zxf $protobuf_tgz_name -C $protobuf_save_dir +export PATH=$protobuf_save_dir/bin:${PATH} \ No newline at end of file diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index 7530e9768..d013a0e39 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -45,8 +45,12 @@ if [[ -f "$failed_wheels" ]]; then exit 1 fi -# Remove useless *-linux*.whl; only keep manylinux*.whl -rm -f dist/*-linux*.whl +ls dist/* -echo "Successfully build wheels:" -find . -type f -iname "*manylinux*.whl" \ No newline at end of file +if [[ "$SYSTEM_NAME" == "CentOS" ]]; then + # Remove useless *-linux*.whl; only keep manylinux*.whl + rm -f dist/*-linux*.whl + + echo "Successfully build wheels:" + find . -type f -iname "*manylinux*.whl" +fi \ No newline at end of file From a98a3cba967a129360ba1024af4723ca26ead7b4 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 22:12:29 +0800 Subject: [PATCH 02/17] fix bug --- .github/workflows/build_and_test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1169b4f60..58d6c9c89 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -111,10 +111,8 @@ jobs: submodules: true - name: Build on macos - uses: docker://quay.io/pypa/manylinux2014_x86_64:latest - with: - entrypoint: bash - args: .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} ${{ matrix.architecture }} Darwin + run: | + bash .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} ${{ matrix.architecture }} Darwin - name: Setup Python 3.8 uses: actions/setup-python@v5 From b08ccaa16497241643218efbd00c0cd3203e90f7 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 22:42:21 +0800 Subject: [PATCH 03/17] test entrypoint.sh --- .github/workflows/scripts/entrypoint.sh | 43 ++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index d013a0e39..c2e45075a 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -11,15 +11,40 @@ PY_VERSION=$1 PLAT=$2 SYSTEM_NAME=$3 -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib +if [[ "$SYSTEM_NAME" == "CentOS" ]] then + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib +elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then + export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib +fi # Compile wheels # Need to be updated if there is a new Python Version -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]} +# declare -A python_map=( ["3.8"]="cp38-cp38" ["3.9"]="cp39-cp39" ["3.10"]="cp310-cp310" ["3.11"]="cp311-cp311" ["3.12"]="cp312-cp312") + +# Map Python version to ABI tag using a case statement +case "$PY_VERSION" in + "3.8") PY_VER="cp38-cp38" ;; + "3.9") PY_VER="cp39-cp39" ;; + "3.10") PY_VER="cp310-cp310" ;; + "3.11") PY_VER="cp311-cp311" ;; + "3.12") PY_VER="cp312-cp312" ;; + *) + echo "Unsupported Python version: $PY_VERSION" + exit 1 + ;; +esac + PIP_INSTALL_COMMAND="/opt/python/${PY_VER}/bin/pip install --no-cache-dir -q" PYTHON_COMMAND="/opt/python/${PY_VER}/bin/python" +# Check if the Python executable exists, fallback for macOS +if [[ ! -x "$PYTHON_COMMAND" ]]; then + if [[ "$SYSTEM_NAME" == "Darwin" ]]; then + PYTHON_COMMAND=$(which python3) + PIP_INSTALL_COMMAND="python3 -m pip install --no-cache-dir -q" + fi +fi + # Update pip and install cmake $PIP_INSTALL_COMMAND --upgrade pip $PIP_INSTALL_COMMAND cmake @@ -27,7 +52,10 @@ $PIP_INSTALL_COMMAND cmake # Build protobuf from source if [[ "$SYSTEM_NAME" == "CentOS" ]]; then yum install -y wget +elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then + which wget || brew install wget fi + source .github/workflows/scripts/download_protobuf.sh # Build Paddle2ONNX wheels @@ -37,7 +65,14 @@ $PYTHON_COMMAND -m build --wheel || { echo "Building wheels failed."; exit 1; } # 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'; }" \; +# find . -type f -iname "*-linux*.whl" -exec sh -c "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> '$failed_wheels'; }" \; +if [[ "$SYSTEM_NAME" == "CentOS" ]]; then + find . -type f -iname "*-linux*.whl" -exec sh -c \ + "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> '$failed_wheels'; }" \; +elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then + find . -type f -iname "*.whl" -exec sh -c \ + "delocate-wheel -w repaired_wheels '{}' || { echo 'Repairing wheels failed.'; echo '{}' >> '$failed_wheels'; }" \; +fi if [[ -f "$failed_wheels" ]]; then echo "Repairing wheels failed:" From ea6cec4d367261cf44dab22bfc15680d0c9c14e9 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 22:44:30 +0800 Subject: [PATCH 04/17] fix bug --- .github/workflows/scripts/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index c2e45075a..1a10121aa 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -11,7 +11,7 @@ PY_VERSION=$1 PLAT=$2 SYSTEM_NAME=$3 -if [[ "$SYSTEM_NAME" == "CentOS" ]] then +if [[ "$SYSTEM_NAME" == "CentOS" ]]; then export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib From 936c0e00899fc2c6574448b43d2b1f610b46a9e9 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 22:52:42 +0800 Subject: [PATCH 05/17] test build on macos-latest --- .github/workflows/scripts/entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index 1a10121aa..57ef3424f 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -40,8 +40,12 @@ PYTHON_COMMAND="/opt/python/${PY_VER}/bin/python" # Check if the Python executable exists, fallback for macOS if [[ ! -x "$PYTHON_COMMAND" ]]; then if [[ "$SYSTEM_NAME" == "Darwin" ]]; then - PYTHON_COMMAND=$(which python3) - PIP_INSTALL_COMMAND="python3 -m pip install --no-cache-dir -q" + PYTHON_COMMAND=$(find /usr/local/bin /usr/bin /opt/homebrew/bin -name "python${PY_VERSION}" -type f 2>/dev/null | head -n 1) + if [[ -z "$PYTHON_COMMAND" ]]; then + echo "Python $PY_VERSION not found on macOS." + exit 1 + fi + PIP_INSTALL_COMMAND="$PYTHON_COMMAND -m pip install --no-cache-dir -q" fi fi From cfe62a31e6e5011b38ca81df3b4e9d7b25d325fe Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 22:56:50 +0800 Subject: [PATCH 06/17] fix bug --- .github/workflows/build_and_test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 58d6c9c89..ae7b89c56 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -109,16 +109,16 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - - name: Build on macos - run: | - bash .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} ${{ matrix.architecture }} Darwin - + - name: Setup Python 3.8 uses: actions/setup-python@v5 with: python-version: '3.8' + - name: Build on macos + run: | + bash .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} ${{ matrix.architecture }} Darwin + # Install Paddle2ONNX - name: Install Paddle2ONNX run: | From 185891cb0f5eee02d47101ffdcbad7a387cd84bf Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 23:02:55 +0800 Subject: [PATCH 07/17] fix bug --- .github/workflows/scripts/entrypoint.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index 57ef3424f..ce0f38637 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -40,11 +40,7 @@ PYTHON_COMMAND="/opt/python/${PY_VER}/bin/python" # Check if the Python executable exists, fallback for macOS if [[ ! -x "$PYTHON_COMMAND" ]]; then if [[ "$SYSTEM_NAME" == "Darwin" ]]; then - PYTHON_COMMAND=$(find /usr/local/bin /usr/bin /opt/homebrew/bin -name "python${PY_VERSION}" -type f 2>/dev/null | head -n 1) - if [[ -z "$PYTHON_COMMAND" ]]; then - echo "Python $PY_VERSION not found on macOS." - exit 1 - fi + PYTHON_COMMAND=python${PY_VERSION} PIP_INSTALL_COMMAND="$PYTHON_COMMAND -m pip install --no-cache-dir -q" fi fi From 176ddeb38f3b153ce3a8baaf5509712827504b64 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Mon, 25 Nov 2024 23:08:50 +0800 Subject: [PATCH 08/17] fix bug --- .github/workflows/build_and_test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ae7b89c56..5c5fdd613 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -114,6 +114,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.8' + + # Install Python dependencies + - name: Install Python dependencies + run: | + python -m pip install -q --upgrade pip + python -m pip install setuptools wheel auditwheel auditwheel-symbols build - name: Build on macos run: | From 5f31c220a94ede1174ef8111a459b58a2b56b267 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Tue, 26 Nov 2024 20:24:54 +0800 Subject: [PATCH 09/17] fix bug --- .github/workflows/build_and_test.yml | 17 +++++--- .github/workflows/scripts/entrypoint.sh | 55 ++++--------------------- 2 files changed, 20 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 5c5fdd613..c1642163d 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -101,7 +101,7 @@ jobs: strategy: matrix: python-version: [ '3.8'] - architecture: [ 'arm64' ] + architecture: ['x86_64', 'arm64'] steps: # Checkout the latest branch of Paddle2ONNX. @@ -115,15 +115,22 @@ jobs: with: python-version: '3.8' + # Download protobuf + - name: Download protobuf + run: | + brew install wget + source .github/workflows/scripts/download_protobuf.sh + # Install Python dependencies - name: Install Python dependencies run: | python -m pip install -q --upgrade pip - python -m pip install setuptools wheel auditwheel auditwheel-symbols build - - - name: Build on macos + python -m pip install setuptools wheel build + + # Build package + - name: Build package run: | - bash .github/workflows/scripts/entrypoint.sh ${{ matrix.python-version }} ${{ matrix.architecture }} Darwin + python -m build --wheel # Install Paddle2ONNX - name: Install Paddle2ONNX diff --git a/.github/workflows/scripts/entrypoint.sh b/.github/workflows/scripts/entrypoint.sh index ce0f38637..7530e9768 100644 --- a/.github/workflows/scripts/entrypoint.sh +++ b/.github/workflows/scripts/entrypoint.sh @@ -11,40 +11,15 @@ PY_VERSION=$1 PLAT=$2 SYSTEM_NAME=$3 -if [[ "$SYSTEM_NAME" == "CentOS" ]]; then - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib -elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then - export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib -fi +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib # Compile wheels # Need to be updated if there is a new Python Version -# declare -A python_map=( ["3.8"]="cp38-cp38" ["3.9"]="cp39-cp39" ["3.10"]="cp310-cp310" ["3.11"]="cp311-cp311" ["3.12"]="cp312-cp312") - -# Map Python version to ABI tag using a case statement -case "$PY_VERSION" in - "3.8") PY_VER="cp38-cp38" ;; - "3.9") PY_VER="cp39-cp39" ;; - "3.10") PY_VER="cp310-cp310" ;; - "3.11") PY_VER="cp311-cp311" ;; - "3.12") PY_VER="cp312-cp312" ;; - *) - echo "Unsupported Python version: $PY_VERSION" - exit 1 - ;; -esac - +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" -# Check if the Python executable exists, fallback for macOS -if [[ ! -x "$PYTHON_COMMAND" ]]; then - if [[ "$SYSTEM_NAME" == "Darwin" ]]; then - PYTHON_COMMAND=python${PY_VERSION} - PIP_INSTALL_COMMAND="$PYTHON_COMMAND -m pip install --no-cache-dir -q" - fi -fi - # Update pip and install cmake $PIP_INSTALL_COMMAND --upgrade pip $PIP_INSTALL_COMMAND cmake @@ -52,10 +27,7 @@ $PIP_INSTALL_COMMAND cmake # Build protobuf from source if [[ "$SYSTEM_NAME" == "CentOS" ]]; then yum install -y wget -elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then - which wget || brew install wget fi - source .github/workflows/scripts/download_protobuf.sh # Build Paddle2ONNX wheels @@ -65,14 +37,7 @@ $PYTHON_COMMAND -m build --wheel || { echo "Building wheels failed."; exit 1; } # 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 [[ "$SYSTEM_NAME" == "CentOS" ]]; then - find . -type f -iname "*-linux*.whl" -exec sh -c \ - "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> '$failed_wheels'; }" \; -elif [[ "$SYSTEM_NAME" == "Darwin" ]]; then - find . -type f -iname "*.whl" -exec sh -c \ - "delocate-wheel -w repaired_wheels '{}' || { echo 'Repairing wheels failed.'; echo '{}' >> '$failed_wheels'; }" \; -fi +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:" @@ -80,12 +45,8 @@ if [[ -f "$failed_wheels" ]]; then exit 1 fi -ls dist/* - -if [[ "$SYSTEM_NAME" == "CentOS" ]]; then - # Remove useless *-linux*.whl; only keep manylinux*.whl - rm -f dist/*-linux*.whl +# Remove useless *-linux*.whl; only keep manylinux*.whl +rm -f dist/*-linux*.whl - echo "Successfully build wheels:" - find . -type f -iname "*manylinux*.whl" -fi \ No newline at end of file +echo "Successfully build wheels:" +find . -type f -iname "*manylinux*.whl" \ No newline at end of file From 7d36776a9879c7dc7f1fd944b48ce0252f2c8a1a Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Tue, 26 Nov 2024 20:49:01 +0800 Subject: [PATCH 10/17] fix bug --- .github/workflows/build_and_test.yml | 4 +++- .github/workflows/scripts/download_protobuf.sh | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c1642163d..338b23d6d 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -118,8 +118,8 @@ jobs: # Download protobuf - name: Download protobuf run: | - brew install wget source .github/workflows/scripts/download_protobuf.sh + protoc --version # Install Python dependencies - name: Install Python dependencies @@ -130,6 +130,8 @@ jobs: # Build package - name: Build package run: | + export PATH="${{ github.workspace }}/installed_protobuf/bin:$PATH" + protoc --version python -m build --wheel # Install Paddle2ONNX diff --git a/.github/workflows/scripts/download_protobuf.sh b/.github/workflows/scripts/download_protobuf.sh index 9f94d3765..1d0722215 100644 --- a/.github/workflows/scripts/download_protobuf.sh +++ b/.github/workflows/scripts/download_protobuf.sh @@ -34,4 +34,5 @@ wget $protobuf_url protobuf_save_dir="$PWD/installed_protobuf" mkdir -p $protobuf_save_dir tar -zxf $protobuf_tgz_name -C $protobuf_save_dir -export PATH=$protobuf_save_dir/bin:${PATH} \ No newline at end of file +export PATH=$protobuf_save_dir/bin:${PATH} +protoc --version \ No newline at end of file From 5f670e0ea920c0625298498ef0732cb3cb8cf5ac Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Tue, 26 Nov 2024 22:00:31 +0800 Subject: [PATCH 11/17] test release_mac --- .github/workflows/build_and_test.yml | 8 +-- .github/workflows/release_mac.yml | 69 +++++++++++++++++++ .../workflows/scripts/download_protobuf.sh | 3 +- VERSION_NUMBER | 2 +- pyproject.toml | 2 +- 5 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release_mac.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 338b23d6d..c59a31f01 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -110,16 +110,17 @@ jobs: with: submodules: true - - name: Setup Python 3.8 + # Setup Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} # Download protobuf - name: Download protobuf run: | source .github/workflows/scripts/download_protobuf.sh - protoc --version # Install Python dependencies - name: Install Python dependencies @@ -131,7 +132,6 @@ jobs: - name: Build package run: | export PATH="${{ github.workspace }}/installed_protobuf/bin:$PATH" - protoc --version python -m build --wheel # Install Paddle2ONNX diff --git a/.github/workflows/release_mac.yml b/.github/workflows/release_mac.yml new file mode 100644 index 000000000..2a964eff1 --- /dev/null +++ b/.github/workflows/release_mac.yml @@ -0,0 +1,69 @@ +name: MacRelease + +on: + release: + types: [published] + +# Use MACOSX_DEPLOYMENT_TARGET=12.0 to produce compatible wheel +env: + MACOSX_DEPLOYMENT_TARGET: "12.0" + +permissions: + contents: read + +jobs: + build: + runs-on: macos-latest + strategy: + matrix: + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] + architecture: ['x86_64', 'arm64'] + + steps: + # Checkout the latest branch of Paddle2ONNX. + - name: Checkout Paddle2ONNX + uses: actions/checkout@v4 + with: + submodules: true + + # Checkout the latest branch of Paddle2ONNX. + - name: Checkout Paddle2ONNX + uses: actions/checkout@v4 + with: + submodules: true + + # Setup Python + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + + # Download protobuf + - name: Download protobuf + run: | + source .github/workflows/scripts/download_protobuf.sh + + # Install Python dependencies + - name: Install Python dependencies + run: | + python -m pip install -q --upgrade pip + python -m pip install setuptools wheel build + + # Build package + - name: Build package + run: | + export PATH="${{ github.workspace }}/installed_protobuf/bin:$PATH" + python -m build --wheel + + - 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.PADDLE2ONNX_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/scripts/download_protobuf.sh b/.github/workflows/scripts/download_protobuf.sh index 1d0722215..9f94d3765 100644 --- a/.github/workflows/scripts/download_protobuf.sh +++ b/.github/workflows/scripts/download_protobuf.sh @@ -34,5 +34,4 @@ wget $protobuf_url protobuf_save_dir="$PWD/installed_protobuf" mkdir -p $protobuf_save_dir tar -zxf $protobuf_tgz_name -C $protobuf_save_dir -export PATH=$protobuf_save_dir/bin:${PATH} -protoc --version \ No newline at end of file +export PATH=$protobuf_save_dir/bin:${PATH} \ No newline at end of file diff --git a/VERSION_NUMBER b/VERSION_NUMBER index 589268e6f..6261a05bb 100644 --- a/VERSION_NUMBER +++ b/VERSION_NUMBER @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.3.1 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cf9102b11..12c1c4cf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -name = "paddle2onnx" +name = "paddle2onnx-win" dynamic = ["version"] description = "Export PaddlePaddle to ONNX" readme = "README.md" From 00cbdcda98474dadd3ef7f7c5ea104cbdd8dcffd Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Tue, 26 Nov 2024 22:16:40 +0800 Subject: [PATCH 12/17] fix bug --- .github/workflows/build_and_test.yml | 2 -- .github/workflows/release_mac.yml | 1 - .github/workflows/release_win_amd64.yml | 1 - 3 files changed, 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c59a31f01..96ae47d2c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -71,7 +71,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} # Install Python dependencies - name: Install Python dependencies @@ -115,7 +114,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} # Download protobuf - name: Download protobuf diff --git a/.github/workflows/release_mac.yml b/.github/workflows/release_mac.yml index 2a964eff1..28bcfca45 100644 --- a/.github/workflows/release_mac.yml +++ b/.github/workflows/release_mac.yml @@ -37,7 +37,6 @@ jobs: uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} # Download protobuf - name: Download protobuf diff --git a/.github/workflows/release_win_amd64.yml b/.github/workflows/release_win_amd64.yml index 87f2b6cfe..87485e28a 100644 --- a/.github/workflows/release_win_amd64.yml +++ b/.github/workflows/release_win_amd64.yml @@ -33,7 +33,6 @@ jobs: uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} # Install Python dependencies - name: Install Python dependencies From bd010816f266bd0723a40e2776367ef26e19ff1c Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Tue, 26 Nov 2024 22:56:31 +0800 Subject: [PATCH 13/17] test release_mac --- .github/workflows/release_mac.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release_mac.yml b/.github/workflows/release_mac.yml index 28bcfca45..a3c293bea 100644 --- a/.github/workflows/release_mac.yml +++ b/.github/workflows/release_mac.yml @@ -47,7 +47,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install -q --upgrade pip - python -m pip install setuptools wheel build + python -m pip install setuptools wheel build twine # Build package - name: Build package @@ -61,8 +61,8 @@ jobs: path: dist - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PADDLE2ONNX_API_TOKEN }} - repository-url: https://test.pypi.org/legacy/ + run: | + python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PADDLE2ONNX_API_TOKEN }} From b41aa06827b5183a6480f14cd63a7a8dc3427f30 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Tue, 26 Nov 2024 23:36:00 +0800 Subject: [PATCH 14/17] fix bug --- .github/workflows/build_and_test.yml | 9 ++++++--- .github/workflows/release_mac.yml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 96ae47d2c..0464bda29 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -96,11 +96,14 @@ jobs: .\run.bat python build_on_macos: + # Use MACOSX_DEPLOYMENT_TARGET=12.0 to produce compatible wheel + env: + MACOSX_DEPLOYMENT_TARGET: "12.0" runs-on: macos-latest strategy: matrix: python-version: [ '3.8'] - architecture: ['x86_64', 'arm64'] + architecture: [ 'x64' ] steps: # Checkout the latest branch of Paddle2ONNX. @@ -110,10 +113,10 @@ jobs: submodules: true # Setup Python - - name: Set up Python ${{ matrix.python-version }} + - name: Setup Python 3.8 uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: '3.8' # Download protobuf - name: Download protobuf diff --git a/.github/workflows/release_mac.yml b/.github/workflows/release_mac.yml index a3c293bea..f34643179 100644 --- a/.github/workflows/release_mac.yml +++ b/.github/workflows/release_mac.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] - architecture: ['x86_64', 'arm64'] + architecture: [ 'arm64' ] steps: # Checkout the latest branch of Paddle2ONNX. From c70b8528849243d621b2b7cda33f312b1c03b2ee Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Wed, 27 Nov 2024 20:40:23 +0800 Subject: [PATCH 15/17] skip test_empty --- .github/workflows/build_and_test.yml | 6 +++--- tests/run.sh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0464bda29..41fd75748 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -103,7 +103,7 @@ jobs: strategy: matrix: python-version: [ '3.8'] - architecture: [ 'x64' ] + architecture: [ 'arm64' ] steps: # Checkout the latest branch of Paddle2ONNX. @@ -113,10 +113,10 @@ jobs: submodules: true # Setup Python - - name: Setup Python 3.8 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: ${{ matrix.python-version }} # Download protobuf - name: Download protobuf diff --git a/tests/run.sh b/tests/run.sh index 324441381..e35d698c0 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -60,7 +60,8 @@ ignore="test_auto_scan_multiclass_nms.py test_quantize_model.py \ test_quantize_model_minist.py \ test_quantize_model_speedup.py \ - test_resnet_fp16.py" + test_resnet_fp16.py \ + test_empty.py" bug=0 # Install Python Packet From 4b835a6a9ca8857baa5b5e748588bf3b16f828c1 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Wed, 27 Nov 2024 22:33:05 +0800 Subject: [PATCH 16/17] test release mac --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 12c1c4cf1..20a021dad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -name = "paddle2onnx-win" +name = "paddle2onnx-mac" dynamic = ["version"] description = "Export PaddlePaddle to ONNX" readme = "README.md" From 0b80abe5fe80144420314ad4672bdb68122499b0 Mon Sep 17 00:00:00 2001 From: ccsuzzh <1719571694@qq.com> Date: Wed, 27 Nov 2024 22:56:25 +0800 Subject: [PATCH 17/17] finish release_mac test --- .github/workflows/build_and_test.yml | 4 ++-- .github/workflows/release_mac.yml | 2 +- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 41fd75748..063dfecaf 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -2,9 +2,9 @@ name: Build and Test on: push: - branches: [ "release_mac" ] + branches: [ "develop" ] pull_request: - branches: [ "release_mac" ] + branches: [ "develop" ] permissions: contents: read diff --git a/.github/workflows/release_mac.yml b/.github/workflows/release_mac.yml index f34643179..d0b61bfc9 100644 --- a/.github/workflows/release_mac.yml +++ b/.github/workflows/release_mac.yml @@ -62,7 +62,7 @@ jobs: - name: Publish package run: | - python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* + python -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/* env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PADDLE2ONNX_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 20a021dad..cf9102b11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -name = "paddle2onnx-mac" +name = "paddle2onnx" dynamic = ["version"] description = "Export PaddlePaddle to ONNX" readme = "README.md"