Skip to content

Commit 9f5eceb

Browse files
committed
.github: move linting jobs into their own workflow
The ruff lint environment was put in a non-passed state since it was run on a previous change set. This is since a change in `doc/conf.py` resulted in a failure and a change on this file only triggered the documentation workflow to run. An update to the workflow trigger events is needed to ensure `doc/conf.py` trigger a lint check. Although, we do not want to force an entire build if the documentation's configuration has just changed. Moving linting into its own workflow handle these scenarios. Signed-off-by: James Knight <[email protected]>
1 parent bb463b9 commit 9f5eceb

File tree

2 files changed

+63
-10
lines changed

2 files changed

+63
-10
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ on:
1111
- '.github/workflows/build.yml'
1212
- 'sphinxcontrib/**'
1313
- 'tests/**'
14-
- '.pylintrc'
1514
- 'MANIFEST.in'
1615
- 'pyproject.toml'
1716
- 'requirements_dev.txt'
18-
- 'ruff.toml'
1917
- 'tox.ini'
2018
pull_request:
2119
branches:
@@ -24,11 +22,9 @@ on:
2422
- '.github/workflows/build.yml'
2523
- 'sphinxcontrib/**'
2624
- 'tests/**'
27-
- '.pylintrc'
2825
- 'MANIFEST.in'
2926
- 'pyproject.toml'
3027
- 'requirements_dev.txt'
31-
- 'ruff.toml'
3228
- 'tox.ini'
3329

3430
jobs:
@@ -63,12 +59,6 @@ jobs:
6359
- { os: macos-latest, python: "3.12", toxenv: py312-sphinx81, cache: ~/Library/Caches/pip }
6460
- { os: windows-latest, python: "3.12", toxenv: py312-sphinx81, cache: ~\AppData\Local\pip\Cache }
6561

66-
# linting/other
67-
# - any OS, using most recent interpreter
68-
- { os: ubuntu-latest, python: "3.12", toxenv: ruff, cache: ~/.cache/pip }
69-
- { os: ubuntu-latest, python: "3.12", toxenv: pylint, cache: ~/.cache/pip }
70-
- { os: ubuntu-latest, python: "3.12", toxenv: mypy, cache: ~/.cache/pip }
71-
7262
steps:
7363
- uses: actions/checkout@v4
7464

.github/workflows/lint.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Action which lints the implementation of this extension.
2+
3+
name: Lint
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- '.github/workflows/lint.yml'
11+
- 'doc/conf.py'
12+
- 'sphinxcontrib/**'
13+
- 'tests/**'
14+
- '.pylintrc'
15+
- 'requirements_dev.txt'
16+
- 'ruff.toml'
17+
- 'tox.ini'
18+
pull_request:
19+
branches:
20+
- main
21+
paths:
22+
- '.github/workflows/lint.yml'
23+
- 'sphinxcontrib/**'
24+
- 'tests/**'
25+
- '.pylintrc'
26+
- 'requirements_dev.txt'
27+
- 'ruff.toml'
28+
- 'tox.ini'
29+
workflow_dispatch:
30+
31+
jobs:
32+
lint:
33+
name: ${{ matrix.toxenv }}
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
include:
38+
- { toxenv: ruff }
39+
- { toxenv: pylint }
40+
- { toxenv: mypy }
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Set up Python ${{ matrix.python }}
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3"
49+
50+
- name: Cache pip
51+
uses: actions/cache@v4
52+
id: cache-pip
53+
with:
54+
path: ~/.cache/pip
55+
key: lint-pip-${{ matrix.toxenv }}
56+
57+
- name: Install dependencies
58+
run: python -m pip install --upgrade tox
59+
60+
- name: tox
61+
env:
62+
TOXENV: ${{ matrix.toxenv }}
63+
run: tox

0 commit comments

Comments
 (0)