1616 PYTHON_LATEST : 3.13
1717
1818jobs :
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,23 +30,12 @@ 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
40- - name : Install check-wheel-content, and twine
41- run : python -m pip install build check-wheel-contents twine
42- - name : Build package
43- run : python -m build
33+ - name : Install tox
34+ run : python -m pip install tox
35+ - name : Build package and check distributions
36+ run : tox run -e build
4437 - name : List result
4538 run : ls -l dist
46- - name : Check wheel contents
47- run : check-wheel-contents dist/*.whl
48- - name : Check long_description
49- run : python -m twine check dist/*
5039 - name : Install pytest-asyncio
5140 run : pip install .
5241 - name : Get version info
5847 name : dist
5948 path : dist
6049
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+
6169 test :
6270 name : ${{ matrix.os }} - Python ${{ matrix.python-version }}
6371 runs-on : ${{ matrix.os }}-latest
@@ -109,7 +117,7 @@ jobs:
109117 check :
110118 name : Check
111119 if : always()
112- needs : [lint, test]
120+ needs : [build, lint, test]
113121 runs-on : ubuntu-latest
114122 steps :
115123 - name : Decide whether the needed jobs succeeded or failed
@@ -145,7 +153,7 @@ jobs:
145153
146154 create-github-release :
147155 name : Create GitHub release
148- needs : [lint, check]
156+ needs : [build, lint, check]
149157 runs-on : ubuntu-latest
150158 permissions :
151159 contents : write
@@ -168,7 +176,7 @@ jobs:
168176 if : ${{ !contains(github.ref, 'refs/tags/') }}
169177 run : towncrier build --draft --version "${version}" > release-notes.rst
170178 env :
171- version : ${{ needs.lint .outputs.version }}
179+ version : ${{ needs.build .outputs.version }}
172180 - name : Extract release notes from Git tag
173181 if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
174182 run : |
@@ -194,16 +202,16 @@ jobs:
194202 if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
195203 uses : ncipollo/release-action@98d25d4189e9b6cee19b8635b1ea5cc39c158a41 # v1.19.2
196204 with :
197- name : pytest-asyncio ${{ needs.lint .outputs.version }}
205+ name : pytest-asyncio ${{ needs.build .outputs.version }}
198206 artifacts : dist/*
199207 bodyFile : release-notes.md
200- prerelease : ${{ needs.lint .outputs.prerelease }}
208+ prerelease : ${{ needs.build .outputs.prerelease }}
201209 token : ${{ secrets.GITHUB_TOKEN }}
202210
203211 publish-test-pypi :
204212 name : Publish packages to test.pypi.org
205213 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
206- needs : [lint, check]
214+ needs : [build, lint, check]
207215 runs-on : ubuntu-latest
208216 permissions :
209217 id-token : write
@@ -222,7 +230,7 @@ jobs:
222230 name : Publish packages to pypi.org
223231 environment : release
224232 if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
225- needs : [lint, check]
233+ needs : [build, lint, check]
226234 runs-on : ubuntu-latest
227235 permissions :
228236 id-token : write
0 commit comments