Skip to content

Commit

Permalink
[pylint] add pylint dev routine
Browse files Browse the repository at this point in the history
 - pre-commit
 - CI
  • Loading branch information
spalmer25 committed Oct 31, 2024
1 parent 89c2577 commit 8f8d517
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
apk add gmp-dev curl jq libsodium-dev git xxd procps
python3 -m venv tezos_test_env --system-site-package
source ./tezos_test_env/bin/activate
python3 -m pip install --upgrade pip -q
python3 -m pip install -r ./tests/requirements.txt -q
TMP_DIR=$(mktemp -d /tmp/foo-XXXXXX)
tar xfz app_${{ matrix.device }}_dbg.tgz -C $TMP_DIR
Expand Down Expand Up @@ -192,6 +193,7 @@ jobs:
apk add gmp-dev curl jq libsodium-dev git xxd procps
python3 -m venv tezos_test_env --system-site-package
source ./tezos_test_env/bin/activate
python3 -m pip install --upgrade pip -q
python3 -m pip install -r ./tests/requirements.txt -q
./tests/integration/run_test_local.sh -T100 -F -m ${{ matrix.device }} tests
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,20 @@ jobs:
source: './app/src'
extensions: 'h,c'
version: 15

pylint_check:
name: Python Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install pylint
run: pip install pylint -r tests/requirements.txt

- name: Run pylint with .pylintrc
run: pylint --errors-only --rcfile=tests/integration/.pylintrc tests/integration/nano/
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
python-version: '3.10'
- run: python -m pip install pre-commit
- run: python -m pip freeze --local
- run: SKIP=clang-format pre-commit run --all-files
- run: SKIP=clang-format,pylint pre-commit run --all-files
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ repos:
language: system
files: ^
types: [file, c]

- id: pylint
name: pylint
description: Run pylint with custom .pylintrc configuration
entry: pylint
language: system
pass_filenames: false
args: ["--errors-only", "--rcfile=tests/integration/.pylintrc", "tests/integration/nano/"]
types: [python]
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ integration_tests_basic_%: app_%.tgz \
apk add gmp-dev curl jq libsodium-dev git xxd procps; \
python3 -m venv tezos_test_env --system-site-package; \
source ./tezos_test_env/bin/activate; \
python3 -m pip install --upgrade pip -q; \
python3 -m pip install -r tests/requirements.txt -q ; \
python3 -m pytest -n 32 tests/integration/nano/ --tb=no \
--device $* --app \$$TMP_DIR/app.elf \
Expand Down
3 changes: 2 additions & 1 deletion scripts/test_swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ run_tests() {
--rm -v "$(realpath .):/app" \
ledger-app-tezos-integration-tests -c \
"cd /app && \
pip install -r test/python/requirements.txt -q && \
pip install --upgrade pip -q && \
pip install -r test/python/requirements.txt -q && \
pip install protobuf==3.20.3 && pytest test/python $*"
)
}
Expand Down
1 change: 1 addition & 0 deletions tests/integration/run_test_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ docker run --rm -it -v "$(realpath .):/app" \
-c " apk add gmp-dev curl jq libsodium-dev git xxd procps; \
python3 -m venv tezos_test_env --system-site-package; \
source ./tezos_test_env/bin/activate; \
python3 -m pip install --upgrade pip -q; \
python3 -m pip install -r tests/requirements.txt -q; \
./tests/integration/run_test_local.sh -F -m $*"
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ base58
pytezos
GitPython
pytest-xdist
ragger[tests,speculos,ledgerwallet]

0 comments on commit 8f8d517

Please sign in to comment.