24
24
steps :
25
25
- name : Clone
26
26
uses : actions/checkout@v3
27
- - run : pip install flake8
27
+ - run : pip install flake8 flake8-pyproject
28
28
- name : Flake8 lint Python code
29
- run : (cd client && find src/ -type f -name '*.py' -exec flake8 --max-line-length=120 '{}' '+' )
29
+ run : (cd client && flake8 src/)
30
30
31
31
mypy :
32
32
name : Type checking
@@ -38,14 +38,43 @@ jobs:
38
38
- name : Mypy type checking
39
39
run : (cd client && mypy src/)
40
40
41
- packaging :
41
+ package_and_deploy :
42
+ name : Build and deploy Ethereum Client Python package
43
+ runs-on : ubuntu-latest
42
44
needs : [lint, mypy]
43
- name : Build, test and deploy the Python package
44
- uses : LedgerHQ/ledger-app-workflows/.github/workflows/reusable_pypi_deployment.yml@v1
45
- with :
46
- package_directory : " client/"
47
- stable_deployment : true
48
- check_changelog_version : ${{ startsWith(github.ref,'refs/tags/') }}
49
- publish : ${{ github.event_name == 'push' }}
50
- secrets :
51
- pypi_token : secrets.PYPI_PUBLIC_API_TOKEN
45
+ steps :
46
+
47
+ - name : Clone
48
+ uses : actions/checkout@v3
49
+ with :
50
+ fetch-depth : 0
51
+
52
+ - name : Build Python package
53
+ run : |
54
+ pip install --upgrade pip build twine
55
+ cd client/
56
+ python -m build;
57
+ python -m twine check dist/*
58
+ pip install .;
59
+ echo "TAG_VERSION=$(python -c 'from ledger_app_clients.ethereum import __version__; print(__version__)')" >> "$GITHUB_ENV"
60
+
61
+ - name : Check version against CHANGELOG
62
+ if : startsWith(github.ref, 'refs/tags/')
63
+ run : |
64
+ CHANGELOG_VERSION=$(grep -Po '(?<=## \[)(\d+\.)+[^\]]' client/CHANGELOG.md | head -n 1)
65
+ if [ "${{ env.TAG_VERSION }}" == "${CHANGELOG_VERSION}" ];
66
+ then
67
+ echo 'Package and CHANGELOG versions match!';
68
+ exit 0;
69
+ else
70
+ echo "Tag '${{ env.TAG_VERSION }}' and CHANGELOG '${CHANGELOG_VERSION}' versions mismatch!";
71
+ exit 1;
72
+ fi
73
+
74
+ - name : Publish Python package on pypi.org
75
+ if : success() && github.event_name == 'push'
76
+ run : (cd client && python -m twine upload --verbose dist/*)
77
+ env :
78
+ TWINE_USERNAME : __token__
79
+ TWINE_PASSWORD : ${{ secrets.PYPI_PUBLIC_API_TOKEN }}
80
+ TWINE_NON_INTERACTIVE : 1
0 commit comments