Add linter GitHub Action #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
pull_request: | |
branches: [ "main" ] | |
# TODO(klecki): Deduplicate this list of directories with `lint.cmake` file | |
env: | |
PYTHON_LINT_PATHS: "./dali ./docs ./tools ./dali_tf_plugin ./qa" | |
AUTOGRAPH_LINT_PATHS: "./dali/python/nvidia/dali/_autograph ./dali/test/python/autograph/" | |
jobs: | |
black: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: pip install "black[jupyter]"==23.11.0 | |
- run: black --check --verbose ${{ env.PYTHON_LINT_PATHS }} ${{ env.AUTOGRAPH_LINT_PATHS }} | |
flake8: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: pip install flake8 | |
- run: flake8 --config=.flake8 ${{ env.PYTHON_LINT_PATHS }} | |
- run: flake8 --config=.flake8.ag ${{ env.AUTOGRAPH_LINT_PATHS }} | |
needs: black | |
cpp: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: python ./tools/lint.py . --nproc=5 |