Skip to content

Add job checking the version bump #37

Add job checking the version bump

Add job checking the version bump #37

Workflow file for this run

---
name: Python client checks, package build and deployment
on:
workflow_dispatch:
push:
branches:
- develop
- master
paths:
- client/**
- .github/workflows/python-client.yml
pull_request:
paths:
- client/**
- .github/workflows/python-client.yml
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- run: pip install flake8
- 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
steps:
- name: Clone
uses: actions/checkout@v3
- run: pip install mypy
- 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.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, version-check]
name: Build, test and deploy the Python package
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_pypi_deployment.yml@v1
with:
package_directory: "client/"
stable_deployment: ${{ github.ref == 'refs/heads/master' }}
check_changelog_version: true
publish: ${{ github.event_name == 'push' }}
secrets:
pypi_token: ${{ github.ref == 'refs/heads/master' && secrets.PYPI_PUBLIC_API_TOKEN || secrets.TEST_PYPI_PUBLIC_API_TOKEN }}