Skip to content

Commit fdaa29f

Browse files
committed
ci: Split lint job into separate jobs for building and linting.
1 parent 93a04a1 commit fdaa29f

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ env:
1616
PYTHON_LATEST: 3.13
1717

1818
jobs:
19-
lint:
20-
name: Run linters
19+
build:
20+
name: Build package
2121
runs-on: ubuntu-latest
2222
outputs:
2323
version: ${{ steps.version.outputs.version }}
@@ -30,13 +30,6 @@ jobs:
3030
- uses: actions/setup-python@v5
3131
with:
3232
python-version: ${{ env.PYTHON_LATEST }}
33-
- name: Install GitHub matcher for ActionLint checker
34-
run: |
35-
echo "::add-matcher::.github/actionlint-matcher.json"
36-
- name: Install pre-commit
37-
run: python -m pip install pre-commit
38-
- name: Run pre-commit checks
39-
run: pre-commit run --all-files --show-diff-on-failure
4033
- name: Install tox
4134
run: python -m pip install tox
4235
- name: Build package and check distributions
@@ -54,6 +47,25 @@ jobs:
5447
name: dist
5548
path: dist
5649

50+
lint:
51+
name: Run linters
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v5
55+
with:
56+
fetch-depth: 0
57+
persist-credentials: false
58+
- uses: actions/setup-python@v5
59+
with:
60+
python-version: ${{ env.PYTHON_LATEST }}
61+
- name: Install GitHub matcher for ActionLint checker
62+
run: |
63+
echo "::add-matcher::.github/actionlint-matcher.json"
64+
- name: Install pre-commit
65+
run: python -m pip install pre-commit
66+
- name: Run pre-commit checks
67+
run: pre-commit run --all-files --show-diff-on-failure
68+
5769
test:
5870
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
5971
runs-on: ${{ matrix.os }}-latest
@@ -105,7 +117,7 @@ jobs:
105117
check:
106118
name: Check
107119
if: always()
108-
needs: [lint, test]
120+
needs: [build, lint, test]
109121
runs-on: ubuntu-latest
110122
steps:
111123
- name: Decide whether the needed jobs succeeded or failed
@@ -141,7 +153,7 @@ jobs:
141153

142154
create-github-release:
143155
name: Create GitHub release
144-
needs: [lint, check]
156+
needs: [build, lint, check]
145157
runs-on: ubuntu-latest
146158
permissions:
147159
contents: write
@@ -164,7 +176,7 @@ jobs:
164176
if: ${{ !contains(github.ref, 'refs/tags/') }}
165177
run: towncrier build --draft --version "${version}" > release-notes.rst
166178
env:
167-
version: ${{ needs.lint.outputs.version }}
179+
version: ${{ needs.build.outputs.version }}
168180
- name: Extract release notes from Git tag
169181
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
170182
run: |
@@ -190,16 +202,16 @@ jobs:
190202
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
191203
uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1.18.0
192204
with:
193-
name: pytest-asyncio ${{ needs.lint.outputs.version }}
205+
name: pytest-asyncio ${{ needs.build.outputs.version }}
194206
artifacts: dist/*
195207
bodyFile: release-notes.md
196-
prerelease: ${{ needs.lint.outputs.prerelease }}
208+
prerelease: ${{ needs.build.outputs.prerelease }}
197209
token: ${{ secrets.GITHUB_TOKEN }}
198210

199211
publish-test-pypi:
200212
name: Publish packages to test.pypi.org
201213
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
202-
needs: [lint, check]
214+
needs: [build, lint, check]
203215
runs-on: ubuntu-latest
204216
permissions:
205217
id-token: write
@@ -218,7 +230,7 @@ jobs:
218230
name: Publish packages to pypi.org
219231
environment: release
220232
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
221-
needs: [lint, check]
233+
needs: [build, lint, check]
222234
runs-on: ubuntu-latest
223235
permissions:
224236
id-token: write

0 commit comments

Comments
 (0)