Skip to content

Commit

Permalink
💄🧪 Separate linting into a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Dec 10, 2023
1 parent 05bbf46 commit 5a51b2a
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 41 deletions.
42 changes: 1 addition & 41 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,47 +95,7 @@ jobs:
retention-days: 15

lint:
name: Linter
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
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
uses: ./.github/workflows/reusable-linters.yml

build-wheels-for-tested-arches:
needs:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/reusable-linters.yml
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
...

0 comments on commit 5a51b2a

Please sign in to comment.