adding multiple linters like black for python which will help us with better quality of python code. Also, in the future, we'll aim to get errors for warnings also but there are a lot of warnings and it is difficult to fix at once. Closes: https://github.com/rook/rook/issues/10374 Signed-off-by: subhamkrai <srai@redhat.com>
62 lines
1.3 KiB
YAML
62 lines
1.3 KiB
YAML
name: Linters
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
branches:
|
|
- master
|
|
- release-*
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- release-*
|
|
|
|
# cancel the in-progress workflow when PR is refreshed.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
yaml-linter:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Install yamllint
|
|
run: pip install yamllint
|
|
|
|
- name: Lint YAML files
|
|
run: yamllint -c .github/workflows/.yamllint deploy/examples/ --no-warnings
|
|
|
|
pylint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Install pylint and requirements
|
|
run: |
|
|
pip install pylint
|
|
pip install pylint --upgrade
|
|
pip install requests
|
|
pip install pygit2
|
|
|
|
- name: Lint Python files
|
|
run: pylint $(git ls-files '*.py') -E
|
|
|
|
- name: Setup black for py
|
|
uses: psf/black@stable
|