From 6d2f7fe3e7559b736f01ed33d1fedb84445d1819 Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Mon, 30 Oct 2023 11:54:00 +0100 Subject: [PATCH] Add job checking the version bump --- .github/workflows/python-client.yml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/.github/workflows/python-client.yml b/.github/workflows/python-client.yml index cb31396738..bc0e45c47c 100644 --- a/.github/workflows/python-client.yml +++ b/.github/workflows/python-client.yml @@ -1,3 +1,4 @@ +--- name: Python client checks, package build and deployment on: @@ -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 @@ -35,6 +37,51 @@ jobs: - name: Mypy type checking run: (cd client && mypy src/) + + get-develop-version: + name: Get develop version + runs-on: ubuntu-latest + outputs: + develop_version: ${{ steps.get-version.outputs.develop_version }} + + steps: + - name: Check Out Code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + + - name: Get version + id: get-version + env: + PYTHONPATH: client/src/ledger_app_clients + run: | + echo "develop_version=$(python -c 'from ethereum import __version__; print(__version__)')" >> $GITHUB_ENV + + + version-check: + name: Check Version when opening a PR against develop + runs-on: ubuntu-latest + needs: get-develop-version + steps: + - name: Check Out Code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + + - name: Check Version Bump + env: + DEVELOP_VERSION: ${{needs.get-develop-version.outputs.develop_version}} + PYTHONPATH: client/src/ledger_app_clients + run: | + current_version=$(python -c "from ethereum import __version__; print(__version__)") + if [[ "$current_version" == "$DEVELOP_VERSION" ]]; then + echo "Version in __init__.py hasn't been bumped. Please bump the version before merging." + exit 1 + fi + + packaging: needs: [lint, mypy] name: Build, test and deploy the Python package