-
-
Notifications
You must be signed in to change notification settings - Fork 28
92 lines (86 loc) · 2.44 KB
/
reusable-linters.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
name: Linters
on:
workflow_call:
secrets:
codecov-token:
description: Mandatory token for uploading to Codecov
required: true
env:
COLOR: >- # Supposedly, pytest or coveragepy use this
yes
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
MYPY_FORCE_COLOR: 1 # MyPy's color enforcement
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_NO_WARN_SCRIPT_LOCATION: 1
PRE_COMMIT_COLOR: always
PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
PYTHONIOENCODING: utf-8
PYTHONUTF8: 1
PYTHON_LATEST: 3.x
jobs:
lint:
name: Linter
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ env.PYTHON_LATEST }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
cache-dependency-path: requirements/*.txt
- name: Cache pre-commit.com virtualenvs
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: >-
${{
runner.os
}}-pre-commit-${{
hashFiles('.pre-commit-config.yaml')
}}
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements/ci.txt
- name: Self-install
run: |
pip install . --config-settings=pure-python=true
- name: Run linters
run: |
make lint
- name: Send coverage data to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.codecov-token }}
files: >-
.tox/.tmp/.mypy/python-3.12/cobertura.xml,
.tox/.tmp/.mypy/python-3.10/cobertura.xml,
.tox/.tmp/.mypy/python-3.8/cobertura.xml
flags: >-
CI-GHA,
MyPy
fail_ci_if_error: true
- name: Install spell checker
run: |
sudo apt install libenchant-2-dev
pip install -r requirements/doc.txt
- name: Run docs spelling
run: |
towncrier build --yes --version 99.99.99
make doc-spelling
- name: Prepare twine checker
run: |
pip install -U build twine
python -m build --config-setting=pure-python=true
- name: Run twine checker
run: |
twine check --strict dist/*
- name: Make sure that CONTRIBUTORS.txt remains sorted
run: |
LC_ALL=C sort -c CONTRIBUTORS.txt
...