diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b79189895..4f21005c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/packages/python/pyproject.toml b/packages/python/pyproject.toml index 7269bf9bc..254c24b6f 100644 --- a/packages/python/pyproject.toml +++ b/packages/python/pyproject.toml @@ -40,7 +40,11 @@ tests = [ 'pytest', 'pytest-cov', 'pytest-benchmark[histogram]', - 'requests' + 'requests', +] +dev = [ + 'mypy', + 'ruff', ] [tool.pytest.ini_options]