-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💄🧪 Separate linting into a reusable workflow
- Loading branch information
Showing
2 changed files
with
67 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
|
||
name: Linters | ||
|
||
on: | ||
workflow_call: | ||
|
||
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: 3 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Python ${{ env.PYTHON_LATEST }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_LATEST }} | ||
cache: pip | ||
cache-dependency-path: requirements/*.txt | ||
- 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: 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 | ||
... |