Skip to content

Commit

Permalink
CI: Reduce number of Python jobs (#3014)
Browse files Browse the repository at this point in the history
With increased use of pre-commit, having nice feedback from the CI checks is less important because contributors should get the feedback from pre-commit and CI is just to check that the files are correct, but not primarily to report to the contributor what quality controls did not pass because that's what should happen locally when the contributor follows contributing guidelines.

This applies to Black and Flake8. Pylint is not in pre-commit. Assuming the other get checked by pre-commit, the Pylint step is the one to fail most likely at the end of the job in case of issues.

Black and Flake8 checks (which are purely static) are done before compilation so that generated files are not checked.

Uses matrix with only single configuration to configure versions. Reports all versions of software in one place.
  • Loading branch information
wenzeslaus committed Jun 6, 2023
1 parent 94cd15f commit 0fa1549
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 93 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/black.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/flake8.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Python Pylint Code Quality
name: Python Code Quality

on:
push:
Expand All @@ -12,8 +12,8 @@ on:
- releasebranch_*

jobs:
pylint:
name: Pylint ${{ matrix.pylint-version }}
python-checks:
name: Python Code Quality

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}-${{
Expand All @@ -28,11 +28,22 @@ jobs:
- os: ubuntu-22.04
python-version: '3.10'
min-python-version: '3.7'
pylint-version: 2.12.2
black-version: '23.1.0'
flake8-version: '3.9.2'
pylint-version: '2.12.2'

runs-on: ${{ matrix.os }}

steps:
- name: Versions
run: |
echo OS: ${{ matrix.os }}
echo Python: ${{ matrix.python-version }}
echo Minimimal Python version: ${{ matrix.min-python-version }}
echo Black: ${{ matrix.black-version }}
echo Flake8: ${{ matrix.flake8-version }}
echo Pylint: ${{ matrix.pylint-version }}
- uses: actions/checkout@v3

- name: Set up Python
Expand All @@ -52,8 +63,22 @@ jobs:
python -m pip install --upgrade pip
pip install -r .github/workflows/python_requirements.txt
pip install -r .github/workflows/optional_requirements.txt
pip install black==${{ matrix.black-version }}
pip install flake8==${{ matrix.flake8-version }}
pip install pylint==${{ matrix.pylint-version }}
- name: Run Black
run: |
black --check --diff .
- name: Run Flake8
run: |
flake8 --count --statistics --show-source --jobs=$(nproc) .
- name: Run Flake8 on additional files
run: |
flake8 --count --statistics --show-source --jobs=$(nproc) python/grass/{script,jupyter}/testsuite/
- name: Create installation directory
run: |
mkdir $HOME/install
Expand Down

0 comments on commit 0fa1549

Please sign in to comment.