Skip to content

Commit

Permalink
Update to download protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheng-Bicheng committed Jun 17, 2024
1 parent cf9f041 commit 60e7dbc
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 75 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release_linux_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
66 changes: 33 additions & 33 deletions .github/workflows/release_linux_x86_64.yml
Original file line number Diff line number Diff line change
@@ -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 }}
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.ZHENG_BICHENG_PYPI_TOKEN }}
22 changes: 0 additions & 22 deletions .github/workflows/scripts/build_protobuf_unix.sh

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/scripts/download_protobuf.sh
Original file line number Diff line number Diff line change
@@ -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}
2 changes: 1 addition & 1 deletion .github/workflows/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
32 changes: 14 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
# Temporary files automatically generated when executing Paddle2ONNX unit tests
*.pdmodel
*.onnx

0 comments on commit 60e7dbc

Please sign in to comment.