| 1 |
name: Lint |
| 2 |
|
| 3 |
concurrency: |
| 4 |
group: lint-${{ github.head_ref || github.ref }} |
| 5 |
cancel-in-progress: true |
| 6 |
|
| 7 |
on: |
| 8 |
push: |
| 9 |
paths: |
| 10 |
- "**.py" |
| 11 |
- ".github/workflows/lint.yml" |
| 12 |
- ".pylintrc" |
| 13 |
- ".flake8" |
| 14 |
- ".mypy.ini" |
| 15 |
pull_request: |
| 16 |
paths: |
| 17 |
- "**.py" |
| 18 |
- ".github/workflows/lint.yml" |
| 19 |
- ".pylintrc" |
| 20 |
- ".flake8" |
| 21 |
- ".mypy.ini" |
| 22 |
|
| 23 |
permissions: |
| 24 |
contents: read |
| 25 |
|
| 26 |
jobs: |
| 27 |
|
| 28 |
pylint: |
| 29 |
runs-on: ubuntu-latest |
| 30 |
steps: |
| 31 |
- uses: actions/checkout@v4 |
| 32 |
- uses: actions/setup-python@v5 |
| 33 |
with: |
| 34 |
python-version: '3.13' |
| 35 |
- run: python -m pip install pylint |
| 36 |
- run: pylint --output-format colorized mesonbuild |
| 37 |
|
| 38 |
flake8: |
| 39 |
runs-on: ubuntu-latest |
| 40 |
steps: |
| 41 |
- uses: actions/checkout@v4 |
| 42 |
- uses: actions/setup-python@v5 |
| 43 |
with: |
| 44 |
python-version: '3.x' |
| 45 |
- run: python -m pip install flake8 |
| 46 |
- run: flake8 --color always mesonbuild/ |
| 47 |
|
| 48 |
mypy: |
| 49 |
runs-on: ubuntu-latest |
| 50 |
steps: |
| 51 |
- uses: actions/checkout@v4 |
| 52 |
- uses: actions/setup-python@v5 |
| 53 |
with: |
| 54 |
python-version: '3.x' |
| 55 |
# Pin mypy to version 1.8, so we retain the ability to lint for Python 3.7 |
| 56 |
- run: python -m pip install "mypy==1.8" strictyaml truststore types-PyYAML types-tqdm types-chevron |
| 57 |
- run: python run_mypy.py --allver |
| 58 |
env: |
| 59 |
PYTHONUNBUFFERED: 1 |
| 60 |
TERM: xterm-color |
| 61 |
MYPY_FORCE_COLOR: 1 |