Skip to content

Commit

Permalink
cherry-picking commit 73e9f6c: Add MacRelease (PaddlePaddle#1445)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ccsuzzh authored and 0x3878f committed Dec 6, 2024
1 parent 1d44430 commit 2d11e88
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 34 deletions.
53 changes: 51 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
68 changes: 68 additions & 0 deletions .github/workflows/release_mac.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 0 additions & 2 deletions .github/workflows/release_win_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/scripts/download_protobuf.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION_NUMBER
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1
29 changes: 1 addition & 28 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d11e88

Please sign in to comment.