From 2d11e88ab4708c1aefafaadde35df62adcece6a7 Mon Sep 17 00:00:00 2001 From: Zhenghai Zhang <65210872+ccsuzzh@users.noreply.github.com> Date: Thu, 28 Nov 2024 20:08:19 +0800 Subject: [PATCH] cherry-picking commit 73e9f6c: Add MacRelease (#1445) * test build on macos-latest * fix bug * test entrypoint.sh * fix bug * test build on macos-latest * fix bug * fix bug * fix bug * fix bug * fix bug * test release_mac * fix bug * test release_mac * fix bug * skip test_empty * test release mac * finish release_mac test --- .github/workflows/build_and_test.yml | 53 ++++++++++++++- .github/workflows/release_mac.yml | 68 +++++++++++++++++++ .github/workflows/release_win_amd64.yml | 2 - .../workflows/scripts/download_protobuf.sh | 16 ++++- VERSION_NUMBER | 2 +- tests/run.sh | 29 +------- 6 files changed, 136 insertions(+), 34 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 0003222ac..4a3ae7980 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -71,8 +71,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} - # Install Python dependencies - name: Install Python dependencies run: | @@ -95,3 +93,54 @@ jobs: working-directory: ./tests run: | .\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: [ 'arm64' ] + + steps: + # 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@v5 + with: + python-version: ${{ matrix.python-version }} + + # 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 + + # 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 diff --git a/.github/workflows/release_mac.yml b/.github/workflows/release_mac.yml new file mode 100644 index 000000000..9881f235e --- /dev/null +++ b/.github/workflows/release_mac.yml @@ -0,0 +1,68 @@ +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: [ '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 }} + + # 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 twine + + # 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 + run: | + 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/.github/workflows/release_win_amd64.yml b/.github/workflows/release_win_amd64.yml index 04d9dc64b..562ef82e8 100644 --- a/.github/workflows/release_win_amd64.yml +++ b/.github/workflows/release_win_amd64.yml @@ -33,8 +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 run: | diff --git a/.github/workflows/scripts/download_protobuf.sh b/.github/workflows/scripts/download_protobuf.sh index adbc6c688..12f3e4b9b 100644 --- a/.github/workflows/scripts/download_protobuf.sh +++ b/.github/workflows/scripts/download_protobuf.sh @@ -1,5 +1,19 @@ #!/bin/bash +# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Detect the operating system OS=$(uname -s) ARCH=$(uname -m) @@ -30,7 +44,7 @@ else echo "The system only supports (Linux and Darwin), but the current system is $OS." fi -wget -q $protobuf_url +wget $protobuf_url protobuf_save_dir="$PWD/installed_protobuf" mkdir -p $protobuf_save_dir tar -zxf $protobuf_tgz_name -C $protobuf_save_dir diff --git a/VERSION_NUMBER b/VERSION_NUMBER index f0bb29e76..3a3cd8cc8 100644 --- a/VERSION_NUMBER +++ b/VERSION_NUMBER @@ -1 +1 @@ -1.3.0 +1.3.1 diff --git a/tests/run.sh b/tests/run.sh index 259e56095..bf7a97506 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -61,34 +61,7 @@ ignore="test_auto_scan_multiclass_nms.py test_quantize_model_minist.py \ test_quantize_model_speedup.py \ test_resnet_fp16.py \ - test_auto_scan_argminmax.py \ - test_auto_scan_assign.py \ - test_auto_scan_concat.py \ - test_auto_scan_cumsum.py \ - test_auto_scan_dropout.py \ - test_auto_scan_expand.py \ - test_auto_scan_eye.py \ - test_auto_scan_fill_constant.py \ - test_auto_scan_gather.py \ - test_auto_scan_interpolate_ops.py \ - test_auto_scan_one_hot_v2.py \ - test_auto_scan_pad3d.py \ - test_auto_scan_pool_max_ops.py \ - test_auto_scan_range.py \ - test_auto_scan_scale.py \ - test_auto_scan_slice.py \ - test_auto_scan_split.py \ - test_auto_scan_squeeze2.py \ - test_auto_scan_strided_slice.py \ - test_auto_scan_tile.py \ - test_auto_scan_top_k.py \ - test_auto_scan_unsqueeze2.py \ - test_einsum.py \ - test_gather.py \ - test_index_select.py \ - test_prelu.py \ - test_repeat_interleave.py \ - test_unique.py " + test_empty.py" bug=0 # Install Python Packet