Skip to content

Commit

Permalink
Add job checking the version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeutin-ledger committed Oct 30, 2023
1 parent a82b61f commit d86a45f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/python-client.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Python client checks, package build and deployment

on:
Expand Down Expand Up @@ -25,6 +26,7 @@ jobs:
- name: Flake8 lint Python code
run: (cd client && find src/ -type f -name '*.py' -exec flake8 --max-line-length=120 '{}' '+')


mypy:
name: Type checking
runs-on: ubuntu-latest
Expand All @@ -35,6 +37,36 @@ jobs:
- name: Mypy type checking
run: (cd client && mypy src/)


version-check:
name: Check Version when opening a PR against develop
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'refs/heads/develop' }}
steps:
- name: Check Out Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4

- name: Get PR Details
id: get-pr-details
run: |
PR_HEAD_VERSION=$(git show HEAD:yourmodule/__init__.py | grep -oP '__version__ = "\K[^"]+')
echo "PR_HEAD_VERSION=$PR_HEAD_VERSION" >> $GITHUB_ENV
- name: Check Version Bump
run: |
current_version=$(python -c "from ethereum import __version__; print(__version__)")
if [[ "$current_version" == "$PR_HEAD_VERSION" ]]; then
echo "Version in __init__.py hasn't been bumped. Please bump the version before merging."
exit 1
fi
env:
PR_HEAD_VERSION: ${{ steps.get-pr-details.outputs.PR_HEAD_VERSION }}
PYTHONPATH: client/src/ledger_app_clients


packaging:
needs: [lint, mypy]
name: Build, test and deploy the Python package
Expand Down

0 comments on commit d86a45f

Please sign in to comment.