Skip to content

Commit

Permalink
add release ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jun 20, 2024
1 parent 9365b9d commit a03de8b
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/release_maixcam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Relase MaixPy for MaixCAM

on:
release:
types: [published]
workflow_dispatch:

permissions: write-all

jobs:
build:
name: release and upload assets task
strategy:
matrix:
python-version: ["3.11"] # must use str, not int, or 3.10 will be recognized as 3.1
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build MaixPy
id: build_maixpy
run: |
echo "-- Check python version must python 3.11 --"
python3 -c 'import sys;print(sys.version);assert sys.version_info >= (3, 11);assert sys.version_info < (3, 12)'
python -c 'import sys;print(sys.version);assert sys.version_info >= (3, 11);assert sys.version_info < (3, 12)'
whereis python
whereis python3
# export PATH=~/.local/bin/:$PATH
# pull sipeed/MaixCDK repo here first
pwd_path=$(pwd)
cd ~
git clone https://github.com/sipeed/MaixCDK --depth=1
export MAIXCDK_PATH=`pwd`/MaixCDK
cd $pwd_path
python -m pip install -U pip setuptools wheel twine
python -m pip install -r $MAIXCDK_PATH/requirements.txt
python -m pip install pybind11-stubgen
echo "--------------------------------"
echo "-- Build MaixPy for Linux now --"
echo "--------------------------------"
sudo apt update -y
sudo apt install -y libopencv-dev libopencv-contrib-dev libsdl2-dev cmake
cmake --version
python setup.py bdist_wheel linux
echo "--------------------------------"
echo "-- Test MaixPy basic for Linux now --"
echo "--------------------------------"
chmod +x ./run.sh && ./run.sh test/test_basic.py
release_path=`ls dist|awk '{print $1}'`
echo ::set-output name=release_linux_path::$release_path
echo ::set-output name=release_linux_name::$release_path
mkdir -p artifact
cp dist/* artifact/
echo "----------------------------------"
echo "-- Build MaixPy for MaixCAM now --"
echo "----------------------------------"
python setup.py bdist_wheel maixcam
cp dist/* artifact/
release_path=`ls dist|awk '{print $1}'`
echo ::set-output name=release_path::$release_path
echo ::set-output name=release_name::$release_path
- name: Publish MaixPy to pypi.org
run: |
echo "[pypi]" > ~/.pypirc
echo " username = __token__" >> ~/.pypirc
echo " password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
twine upload artifact/*.whl
- name: Upload MaixPy MaixCAM to release assets
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.build_maixpy.outputs.release_path }}
asset_name: ${{ steps.build_maixpy.outputs.release_name }}
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload MaixPy Linux to release assets
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.build_maixpy.outputs.release_linux_path }}
asset_name: ${{ steps.build_maixpy.outputs.release_linux_name }}
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}

69 changes: 69 additions & 0 deletions .github/workflows/release_other_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Relase MaixPy for MaixCAM

on:
release:
types: [published]
workflow_dispatch:

permissions: write-all

jobs:
build:
name: release and upload assets task
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.12"] # 3.11 released by release_maixcam
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build MaixPy
id: build_maixpy
run: |
echo "-- Check python version must python 3.11 --"
python3 -c 'import sys;print(sys.version);assert sys.version_info >= (3, 11);assert sys.version_info < (3, 12)'
python -c 'import sys;print(sys.version);assert sys.version_info >= (3, 11);assert sys.version_info < (3, 12)'
whereis python
whereis python3
# export PATH=~/.local/bin/:$PATH
# pull sipeed/MaixCDK repo here first
pwd_path=$(pwd)
cd ~
git clone https://github.com/sipeed/MaixCDK --depth=1
export MAIXCDK_PATH=`pwd`/MaixCDK
cd $pwd_path
python -m pip install -U pip setuptools wheel twine
python -m pip install -r $MAIXCDK_PATH/requirements.txt
python -m pip install pybind11-stubgen
echo "--------------------------------"
echo "-- Build MaixPy for Linux now --"
echo "--------------------------------"
sudo apt update -y
sudo apt install -y libopencv-dev libopencv-contrib-dev libsdl2-dev cmake
cmake --version
python setup.py bdist_wheel linux
echo "--------------------------------"
echo "-- Test MaixPy basic for Linux now --"
echo "--------------------------------"
release_path=`ls dist|awk '{print $1}'`
echo ::set-output name=release_path::$release_path
echo ::set-output name=release_name::$release_path
- name: Publish MaixPy to pypi.org
run: |
echo "[pypi]" > ~/.pypirc
echo " username = __token__" >> ~/.pypirc
echo " password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
twine upload dist/*.whl
- name: Upload to release assets
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.build_maixpy.outputs.release_path }}
asset_name: ${{ steps.build_maixpy.outputs.release_name }}
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a03de8b

Please sign in to comment.