Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[bumpversion]
tag_name = rc/v{new_version}
current_version = 1.2.21
current_version = 1.2.27
140 changes: 111 additions & 29 deletions .github/workflows/build-and-publish-TestPyPI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ jobs:
with:
persist-credentials: false
# cut assumes version number is surrounded by double-quotes.
- name: Get Current Version
run: echo "current_version=$(grep "version" setup.py | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Get Original Version
run: echo "original_version=$(grep "version" setup.py | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Auto Bump Package Version
uses: FragileTech/bump-version@main
with:
current_version: "${{ env.current_version }}"
current_version: "${{ env.original_version }}"
files: setup.py
part: patch
commit_name: bot-edgepi
commit_email: bot@edgepi.com
login: bot-edgepi
token: "${{ secrets.ACTIONS_BOT_TOKEN }}"
- name: Get Current Version
run: echo "current_version=$(grep "version" setup.py | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v3
with:
Expand All @@ -48,8 +50,113 @@ jobs:
- name: Publish Distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
verbose: true
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
# Handling Failure Delete Tag: this step only gets executed when there's a failed step.
# When the job finishes with failed step, the tag created from bump version acrtion gets deleted
- name: Handling Failure Delete tag
if: failure()
env:
commit_name: bot-edgepi
commit_email: bot@edgepi.com
login: bot-edgepi
token: "${{ secrets.ACTIONS_BOT_TOKEN }}"
run: |
set -x
# Setup Git env and user
git config user.name ${{ env.commit_name }}
git config user.email ${{ env.commit_email }}
git config --global pull.rebase false
BRANCH=${GITHUB_REF#refs/heads/}
git pull --no-edit ${{ env.login }} $BRANCH
git config --global url."https://${{ env.login }}:${{ env.token }}@github.com/".insteadOf "https://github.com/"
# merge done by git pull does not update submodules changed in $BRANCH
git submodule update --init --recursive

# Delete Git tags
git tag -d rc/v${{ env.current_version }}
git push origin --delete rc/v${{ env.current_version }}
git config --global --unset url."https://${{ env.login }}:${{ env.token }}@github.com/".insteadOf

# Decrementing the current version number, this may be needed later.
# my_var=$(echo $(grep "version" setup.py | cut -d '"' -f2 | cut -d '.' -f3))
# my_var=$(echo $((my_var-1)))
# Write the reverted version number back to setup file and
# sed -i "s/\(version=\"[0-9]\+\.[0-9]\+\.\)[0-9]\+\"/\1$my_var\"/" setup.py
# sed -i "s/\(current_version = [0-9]\+\.[0-9]\+\.\)[0-9]\+/\1$my_var/" .bumpversion.cfg
# git add . && git commit -m "Failed Publish Job --- decremented version" && git push

Hardware_Test:
needs: publish
name: Hardware Tests
runs-on: [self-hosted, linux, ARM64, integration]
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
steps:
# Wait for 1 minutes for TestPyPI to be updated
- name: Sleep for 1 minute
run: sleep 60s
shell: bash
- name: Checkout
uses: actions/checkout@v3
with:
ref: staging
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
fetch-depth: 0
- name: Install Dependencies and check SDK versions
run: |
python -m venv venv_hardware_test
source venv_hardware_test/bin/activate
python -m pip install --upgrade pip
python -m pip install pytest
if [ -f requirements_hw_test.txt ]; then pip install -r requirements_hw_test.txt; fi
echo "actual_sdk_version=$(pip list | grep edgepi | cut -d ' ' -f2)" >> $GITHUB_ENV
echo "expected_sdk_version=$(grep "version" setup.py | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Compare versions
run: |
if [ ${{env.expected_sdk_version}} != ${{env.actual_sdk_version}} ]; then
echo "SDK Version Mismatch"
exit 1
fi
- name: Test with pytest
run: |
source venv_hardware_test/bin/activate
python -m pytest ./tests/hardware_tests
# Handling Failure Delete Tag: this step only gets executed when there's a failed step.
# When the job finishes with failed step, the tag created from bump version acrtion gets deleted
- name: Handling Failure Delete tag
if: failure()
env:
commit_name: bot-edgepi
commit_email: bot@edgepi.com
login: bot-edgepi
token: "${{ secrets.ACTIONS_BOT_TOKEN }}"
run: |
set -x
# Setup Git env and user
git config user.name ${{ env.commit_name }}
git config user.email ${{ env.commit_email }}
git config --global pull.rebase false
BRANCH=${GITHUB_REF#refs/heads/}
git remote add ${{ env.login }} https://${{ env.login }}:${{ env.token }}@github.com/$GITHUB_REPOSITORY
git pull --no-edit ${{ env.login }} $BRANCH
git config --global url."https://${{ env.login }}:${{ env.token }}@github.com/".insteadOf "https://github.com/"
# merge done by git pull does not update submodules changed in $BRANCH
git submodule update --init --recursive

# Delete Git tags
git tag -d rc/v${{ env.expected_sdk_version }}
git push origin --delete rc/v${{ env.expected_sdk_version }}
git config --global --unset url."https://${{ env.login }}:${{ env.token }}@github.com/".insteadOf

Bump_version_on_dev:
name: Bump version numbers in Dev
needs: Hardware_Test
runs-on: ubuntu-latest
steps:
- name: Checkout Dev
uses: actions/checkout@v3
with:
Expand All @@ -68,29 +175,4 @@ jobs:
git config user.name ${{ env.commit_name }}
git config user.email ${{ env.commit_email }}
git cherry-pick ${{ env.bump_commit }}
git push origin dev


# Hardware_Test:
# needs: publish
# name: Hardware Tests
# runs-on: [self-hosted, linux, ARM64, hw-test]
# strategy:
# fail-fast: false
# matrix:
# python-version: ["3.9"]

# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Install Dependencies
# run: |
# python -m venv venv_hardware_test
# source venv_hardware_test/bin/activate
# python -m pip install --upgrade pip
# python -m pip install pytest
# if [ -f requirements_hw_test.txt ]; then pip install -r requirements_hw_test.txt; fi
# - name: Test with pytest
# run: |
# source venv_hardware_test/bin/activate
# python -m pytest ./tests/hardware_tests
git push origin dev
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ disable=logging-fstring-interpolation,
duplicate-code,
no-else-return,
no-else-raise,
too-many-positional-arguments,
logging-fstring-interpolation

[LOGGING]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="edgepi-python-sdk",
version="1.2.21",
version="1.2.27",
author="S.Park",
author_email="spark@osensa.com",
description="EdgePi Python SDK package",
Expand Down
Loading