summaryrefslogtreecommitdiffstats
path: root/.github/workflows/pr.yml
blob: 67ae43686b1c6dcfe46af2cc79b2aaea4285f45c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: PR Pylint, PEP8 and Pytest

on: pull_request

jobs:
  test_pylint:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.x]
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: Get changed Python files
      uses: dorny/paths-filter@v2
      id: paths-filter
      with:
        list-files: 'shell'
        filters: |
          code:
            - added|modified: '!(ranger/config)**.py'
          config:
            - added|modified: 'ranger/config/**.py'
    - name: Lint code with Flake8 and Pylint
      if: ${{ steps.path-filter.outputs.code == 'true' }}
      run: |
        flake8 ${{ steps.paths-filter.outputs.code_files }}
        pylint ${{ steps.paths-filter.outputs.code_files }}
    - name: Lint config with Flake8 and Pylint
      if: ${{ steps.path-filter.outputs.config == 'true' }}
      run: |
        flake8 ${{ steps.paths-filter.outputs.config }}
        pylint --rcfile=ranger/config/.pylintrc \
          ${{ steps.paths-filter.outputs.config_files }}
    - name: Test code with Pytest
      if: ${{ steps.path-filter.outputs.code == 'true' }}
      run: |
        make test_pytest