Skip to content

Commit 08077ff

Browse files
committed
[ci][fix] Falling back to explicit package build, test & publish rather than using the reusable workflow
1 parent 0836e42 commit 08077ff

File tree

2 files changed

+44
-12
lines changed

2 files changed

+44
-12
lines changed

.github/workflows/python-client.yml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
steps:
2525
- name: Clone
2626
uses: actions/checkout@v3
27-
- run: pip install flake8
27+
- run: pip install flake8 flake8-pyproject
2828
- 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/)
3030

3131
mypy:
3232
name: Type checking
@@ -38,14 +38,43 @@ jobs:
3838
- name: Mypy type checking
3939
run: (cd client && mypy src/)
4040

41-
packaging:
41+
package_and_deploy:
42+
name: Build and deploy Ethereum Client Python package
43+
runs-on: ubuntu-latest
4244
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

client/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ Home = "https://github.com/LedgerHQ/app-ethereum"
4646

4747
[tool.mypy]
4848
ignore_missing_imports = true
49+
50+
[tool.flake8]
51+
max-line-length = 120

0 commit comments

Comments
 (0)