mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
fix(pull-request.yml): launch linters when source code modified (#2922)
This commit is contained in:
27
.github/workflows/pull-request.yml
vendored
27
.github/workflows/pull-request.yml
vendored
@@ -20,23 +20,24 @@ jobs:
|
|||||||
id: are-non-ignored-files-changed
|
id: are-non-ignored-files-changed
|
||||||
uses: tj-actions/changed-files@v39
|
uses: tj-actions/changed-files@v39
|
||||||
with:
|
with:
|
||||||
|
files: ./**
|
||||||
files_ignore: |
|
files_ignore: |
|
||||||
.github/**
|
.github/**
|
||||||
README.md
|
README.md
|
||||||
docs/**
|
docs/**
|
||||||
- name: Install poetry
|
- name: Install poetry
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pipx install poetry
|
pipx install poetry
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
cache: "poetry"
|
cache: "poetry"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry install
|
poetry install
|
||||||
poetry run pip list
|
poetry run pip list
|
||||||
@@ -46,43 +47,43 @@ jobs:
|
|||||||
) && curl -L -o /tmp/hadolint "https://github.com/hadolint/hadolint/releases/download/v${VERSION}/hadolint-Linux-x86_64" \
|
) && curl -L -o /tmp/hadolint "https://github.com/hadolint/hadolint/releases/download/v${VERSION}/hadolint-Linux-x86_64" \
|
||||||
&& chmod +x /tmp/hadolint
|
&& chmod +x /tmp/hadolint
|
||||||
- name: Poetry check
|
- name: Poetry check
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry lock --check
|
poetry lock --check
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run flake8 . --ignore=E266,W503,E203,E501,W605,E128 --exclude contrib
|
poetry run flake8 . --ignore=E266,W503,E203,E501,W605,E128 --exclude contrib
|
||||||
- name: Checking format with black
|
- name: Checking format with black
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run black --check .
|
poetry run black --check .
|
||||||
- name: Lint with pylint
|
- name: Lint with pylint
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run pylint --disable=W,C,R,E -j 0 -rn -sn prowler/
|
poetry run pylint --disable=W,C,R,E -j 0 -rn -sn prowler/
|
||||||
- name: Bandit
|
- name: Bandit
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run bandit -q -lll -x '*_test.py,./contrib/' -r .
|
poetry run bandit -q -lll -x '*_test.py,./contrib/' -r .
|
||||||
- name: Safety
|
- name: Safety
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run safety check
|
poetry run safety check
|
||||||
- name: Vulture
|
- name: Vulture
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run vulture --exclude "contrib" --min-confidence 100 .
|
poetry run vulture --exclude "contrib" --min-confidence 100 .
|
||||||
- name: Hadolint
|
- name: Hadolint
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
/tmp/hadolint Dockerfile --ignore=DL3013
|
/tmp/hadolint Dockerfile --ignore=DL3013
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
poetry run pytest -n auto --cov=./prowler --cov-report=xml tests
|
poetry run pytest -n auto --cov=./prowler --cov-report=xml tests
|
||||||
- name: Upload coverage reports to Codecov
|
- name: Upload coverage reports to Codecov
|
||||||
if: steps.are-non-ignored-files-changed.outputs.test_any_changed == true
|
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user