Skip to content

Commit 27165cf

Browse files
authored
Use build-and-inspect-python-package action (#10722)
This uses https://github.com/hynek/build-and-inspect-python-package to ensure our package is correct, both during testing and deploy,
1 parent 7a829cb commit 27165cf

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@ jobs:
2828
fetch-depth: 0
2929
persist-credentials: false
3030

31+
- name: Build and Check Package
32+
uses: hynek/build-and-inspect-python-package@v1.5
33+
34+
- name: Download Package
35+
uses: actions/download-artifact@v3
36+
with:
37+
name: Packages
38+
path: dist
39+
40+
- name: Publish package to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1
42+
with:
43+
password: ${{ secrets.pypi_token }}
44+
3145
- name: Set up Python
3246
uses: actions/setup-python@v4
3347
with:
3448
python-version: "3.7"
3549

36-
- name: Install dependencies
50+
- name: Install tox
3751
run: |
3852
python -m pip install --upgrade pip
39-
pip install --upgrade build tox
40-
41-
- name: Build package
42-
run: |
43-
python -m build
44-
45-
- name: Publish package to PyPI
46-
uses: pypa/gh-action-pypi-publish@release/v1
47-
with:
48-
password: ${{ secrets.pypi_token }}
53+
pip install --upgrade tox
4954
5055
- name: Publish GitHub release notes
5156
env:

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
env:
1919
PYTEST_ADDOPTS: "--color=yes"
2020

21+
# Cancel running jobs for the same workflow and branch.
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
2126
# Set permissions at the job level.
2227
permissions: {}
2328

@@ -189,3 +194,10 @@ jobs:
189194
fail_ci_if_error: true
190195
files: ./coverage.xml
191196
verbose: true
197+
198+
check-package:
199+
runs-on: ubuntu-latest
200+
steps:
201+
- uses: actions/checkout@v3
202+
- name: Build and Check Package
203+
uses: hynek/build-and-inspect-python-package@v1.5

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,8 @@ template = "changelog/_template.rst"
114114

115115
[tool.black]
116116
target-version = ['py37']
117+
118+
# check-wheel-contents is executed by the build-and-inspect-python-package action.
119+
[tool.check-wheel-contents]
120+
# W009: Wheel contains multiple toplevel library entries
121+
ignore = "W009"

0 commit comments

Comments
 (0)