Skip to content

Commit

Permalink
ci: add Python formatting, linting and type checking (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem authored Mar 5, 2024
2 parents 0b449c9 + 313f4c6 commit 149c8a3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,46 @@ jobs:
exit 1
fi
format-python:
name: Check linting, formatting and typing
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/python
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0

- name: pip update and add build package
run: bash proto2python.sh ~/pyvenv

- name: Install dependencies
run: pip install "$(echo pkg/armonik*.whl)[dev]"

- name: Lint
run: python -m ruff .

- name: Check typing
run: python -m mypy --exclude src/armonik/protogen/ src/

- name: Check format
run: python -m ruff format .

- name: Check Diff
run: |
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
format-cpp:
name: Format C++
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion packages/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ tests = [
'pytest',
'pytest-cov',
'pytest-benchmark[histogram]',
'requests'
'requests',
]
dev = [
'mypy',
'ruff',
]

[tool.pytest.ini_options]
Expand Down

0 comments on commit 149c8a3

Please sign in to comment.