|
1 | 1 | name: Check analyzers |
2 | 2 | description: > |
3 | | - This workflow checks the code quality of a Python package using various |
| 3 | + This workflow checks the code quality of a Python project using various |
4 | 4 | analyzers like linters and type checkers, including ni-python-styleguide, |
5 | 5 | mypy, bandit, and pyright. It is designed to be reusable across different |
6 | 6 | projects and can be easily integrated into existing CI/CD pipelines. |
|
11 | 11 | project-directory: |
12 | 12 | description: Path to the directory containing pyproject.toml. |
13 | 13 | default: ${{ github.workspace }} |
14 | | - install-extras: |
15 | | - description: 'List of Poetry extras to install (comma separated)' |
| 14 | + extras: |
| 15 | + # E.g. "docs drivers" |
| 16 | + description: 'List of Poetry extras to install (separated by spaces)' |
16 | 17 | default: '' |
17 | 18 | required: false |
18 | 19 | type: string |
|
53 | 54 | - name: Install ${{ steps.get_package_info.outputs.name }} |
54 | 55 | run: | |
55 | 56 | if [ "${{ inputs.install-extras }}" != "" ]; then |
56 | | - poetry install -v --extras "${{ inputs.install-extras }}" |
| 57 | + EXTRAS_ARGS="" |
| 58 | + for extra in ${{ inputs.extras }}; do |
| 59 | + EXTRAS_ARGS="$EXTRAS_ARGS -E $extra" |
| 60 | + done |
| 61 | + poetry install -v $EXTRAS_ARGS |
57 | 62 | else |
58 | 63 | poetry install -v |
59 | 64 | fi |
|
63 | 68 | run: poetry run mypy |
64 | 69 | - name: Mypy static analysis (Windows) |
65 | 70 | run: poetry run mypy --platform win32 |
| 71 | + # Assumes there are 'targets' in pyproject.toml for Bandit |
66 | 72 | - name: Bandit security checks |
67 | | - run: poetry run bandit -c pyproject.toml -r src/ |
| 73 | + run: poetry run bandit -c pyproject.toml -r |
68 | 74 | - name: Add virtualenv to the path for pyright-action |
69 | 75 | run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH |
70 | 76 | - name: Pyright static analysis (Linux) |
|
0 commit comments