Skip to content

Commit

Permalink
Update pylint yml file
Browse files Browse the repository at this point in the history
Changed the file by complete to comply with new updated from github
  • Loading branch information
dmtzs committed Dec 19, 2023
1 parent 658d018 commit 242b473
Showing 1 changed file with 22 additions and 37 deletions.
59 changes: 22 additions & 37 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,47 @@ name: Pylint
on:
push:
branches:
- development
- '*'
- '!master'
- '!development'

jobs:
changes:
name: Verify files
build:
name: Executing pylint
runs-on: ubuntu-latest
outputs:
api: ${{ steps.filter.outputs.api }}
env:
CHANGED: 0
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
name: Accessing to files
with:
fetch-depth: 2 # last 2 commits

- name: Extracting branch name
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" #output: dmtzs-test-pylint1 or other branch name
run: echo "Current branch is ${GITHUB_REF##*/}"
id: extract_branch

- uses: dorny/paths-filter@v2
name: Verifying changes in files
id: filter
with:
base: ${{ steps.extract_branch.outputs.branch }} #Uses the branch that trigger the workflow
filters: |
api:
- 'src/**.py'
# run only if 'api' files were changed
- name: workflow tests
if: steps.filter.outputs.api == 'true'
run: echo "Files changed, running deployment job"

# run only if not 'api' files were changed
- name: not workflow tests
if: steps.filter.outputs.api != 'true'
run: echo "Files not changed, passing the deployment job"

build:
needs: changes
name: Executing pylint
runs-on: ubuntu-latest
- name: Check for Python file changes
id: check_files
run: |
CHANGED=$(git diff --name-only HEAD^ HEAD | grep '\.py$' | wc -l)
echo "CHANGED=$CHANGED" >> $GITHUB_ENV
if: needs.changes.outputs.api == 'true'
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
if: env.CHANGED != '0'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
if: env.CHANGED != '0'
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
if: env.CHANGED != '0'
run: |
pylint $(git ls-files './src*.py') --rcfile=.github/config/.pylintrc ./

0 comments on commit 242b473

Please sign in to comment.