|
1 |
| -name: Code Format Check |
| 1 | +# SPDX-FileCopyrightText: 2024 K Kollmann |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | + |
| 4 | +name: Code formatting and linting |
2 | 5 |
|
3 | 6 | on:
|
| 7 | + pull_request: |
4 | 8 | push:
|
5 | 9 | branches:
|
6 | 10 | - master
|
7 |
| - pull_request: |
| 11 | + - main |
| 12 | + workflow_dispatch: |
8 | 13 |
|
| 14 | +env: |
| 15 | + PYTHON_VERSION: "3.9" |
9 | 16 |
|
10 | 17 | jobs:
|
11 | 18 | black:
|
| 19 | + name: Black code formatter |
12 | 20 | runs-on: ubuntu-latest
|
13 |
| - name: Black |
14 | 21 | steps:
|
15 |
| - |
16 |
| - - name: Set up Python |
17 |
| - |
18 |
| - - name: Black |
19 |
| - uses: psf/[email protected] # already includes args "--check --diff" |
| 22 | + - name: Checkout repo |
| 23 | + |
| 24 | + with: |
| 25 | + ref: ${{ github.event.pull_request.head.sha }} |
| 26 | + - name: Run Black |
| 27 | + |
| 28 | + with: |
| 29 | + options: "--version --check --diff --color" # default: "--check --diff" |
| 30 | + |
20 | 31 | flake8:
|
| 32 | + name: Flake8 linter |
21 | 33 | runs-on: ubuntu-latest
|
22 |
| - name: Flake8 |
23 | 34 | steps:
|
24 |
| - |
25 |
| - - name: Set up Python |
| 35 | + - name: Checkout repo |
| 36 | + |
| 37 | + with: |
| 38 | + ref: ${{ github.event.pull_request.head.sha }} |
| 39 | + - name: Set up Python environment – ${{ env.PYTHON_VERSION }} |
26 | 40 |
|
27 | 41 | with:
|
28 |
| - python-version: '3.9' |
| 42 | + python-version: ${{ env.PYTHON_VERSION }} |
29 | 43 | - name: Install dependencies
|
30 | 44 | run: |
|
31 | 45 | python -m pip install --upgrade wheel pip
|
32 | 46 | pip install .[lint]
|
33 |
| - - name: Lint examples |
34 |
| - run: flake8 examples --show-source |
35 |
| - - name: Lint scripts |
36 |
| - run: flake8 setup.py docs/conf.py scripts --show-source |
37 |
| - - name: Lint tests |
38 |
| - run: flake8 tests --show-source |
39 |
| - - name: Lint moviepy |
40 |
| - run: flake8 moviepy --show-source |
| 47 | + - name: Show Flake8 version |
| 48 | + run: flake8 --version |
| 49 | + - name: Run Flake8 |
| 50 | + run: flake8 -v --show-source moviepy setup.py scripts docs/conf.py examples tests |
| 51 | + |
41 | 52 | isort:
|
| 53 | + name: isort import sorter |
42 | 54 | runs-on: ubuntu-latest
|
43 |
| - name: isort |
44 | 55 | steps:
|
45 |
| - |
46 |
| - - name: Set up Python |
| 56 | + - name: Checkout repo |
| 57 | + |
| 58 | + with: |
| 59 | + ref: ${{ github.event.pull_request.head.sha }} |
| 60 | + - name: Set up Python environment – ${{ env.PYTHON_VERSION }} |
47 | 61 |
|
48 | 62 | with:
|
49 |
| - python-version: '3.9' |
| 63 | + python-version: ${{ env.PYTHON_VERSION }} |
50 | 64 | - name: Install dependencies
|
51 | 65 | run: |
|
52 |
| - python -m pip install --upgrade pip |
53 |
| - pip install isort |
54 |
| - - name: Check imports |
55 |
| - run: isort --check-only moviepy tests examples docs/conf.py scripts |
| 66 | + python -m pip install --upgrade wheel pip |
| 67 | + pip install .[lint] |
| 68 | + - name: Run isort |
| 69 | + run: isort --check-only --diff moviepy setup.py scripts docs/conf.py examples tests |
0 commit comments