diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index c777b9534d0..00000000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: Python Black Formatting - -on: - push: - branches: - - main - - releasebranch_* - pull_request: - branches: - - main - - releasebranch_* - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - run-black: - name: Black - - # Using matrix just to get variables which are not environmental variables - # and also to sync with other workflows which use matrix. - strategy: - matrix: - include: - - os: ubuntu-22.04 - python-version: '3.10' - black-version: '23.1.0' - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install - run: | - python -m pip install --upgrade pip - pip install black==${{ matrix.black-version }} - - - name: Run Black - run: | - black --check --diff . diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index 75fb07a2025..00000000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: Python Flake8 Code Quality - -on: - push: - branches: - - main - - releasebranch_* - pull_request: - branches: - - main - - releasebranch_* - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - flake8: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install - run: | - python -m pip install --upgrade pip - pip install flake8==3.9.2 - - - 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/ diff --git a/.github/workflows/pylint.yml b/.github/workflows/python-code-quality.yml similarity index 79% rename from .github/workflows/pylint.yml rename to .github/workflows/python-code-quality.yml index d4e021d8636..7ad02b39960 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/python-code-quality.yml @@ -1,5 +1,5 @@ --- -name: Python Pylint Code Quality +name: Python Code Quality on: push: @@ -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 }}-${{ @@ -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 @@ -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