Skip to content

Commit

Permalink
Add MacRelease (#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 Nov 28, 2024
1 parent 49fc963 commit 73e9f6c
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 9 deletions.
54 changes: 52 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -94,4 +93,55 @@ jobs:
- name: Run Test
working-directory: ./tests
run: |
.\run.bat python
.\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 }}
1 change: 0 additions & 1 deletion .github/workflows/release_win_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/scripts/download_protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
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}
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
3 changes: 2 additions & 1 deletion tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 73e9f6c

Please sign in to comment.