Skip to content

Commit 4152891

Browse files
migrate to hynek/build-and-inspect-python-package for packaging and testing
1 parent 86c04e7 commit 4152891

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

.github/workflows/main.yml

+24-20
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@ on:
1212
- main
1313

1414
jobs:
15-
build:
15+
check-package:
16+
name: Build & inspect our package.
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- uses: hynek/build-and-inspect-python-package@v2
24+
test:
25+
needs: [check-package]
1626
runs-on: ${{ matrix.os }}
1727

1828
strategy:
@@ -87,9 +97,11 @@ jobs:
8797

8898
steps:
8999
- uses: actions/checkout@v4
100+
- name: Download built packages from the check-package job.
101+
uses: actions/download-artifact@v4
90102
with:
91-
fetch-depth: 0
92-
103+
name: Packages
104+
path: dist
93105
- name: Set up Python ${{ matrix.python }}
94106
uses: actions/setup-python@v5
95107
with:
@@ -103,11 +115,13 @@ jobs:
103115
104116
- name: Test without coverage
105117
if: "! matrix.use_coverage"
106-
run: "tox -e ${{ matrix.tox_env }}"
118+
shell: bash
119+
run: "tox run -e ${{ matrix.tox_env }} --installpkg dist/*.whl"
107120

108121
- name: Test with coverage
109122
if: "matrix.use_coverage"
110-
run: "tox -e ${{ matrix.tox_env }}-coverage"
123+
shell: bash
124+
run: "tox run -e ${{ matrix.tox_env }}-coverage --installpkg dist/*.whl"
111125

112126
- name: Upload coverage
113127
if: matrix.use_coverage && github.repository == 'pytest-dev/pluggy'
@@ -119,27 +133,17 @@ jobs:
119133
verbose: true
120134

121135
deploy:
136+
needs: [check-package]
122137
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pluggy'
123138
runs-on: ubuntu-latest
124139
permissions:
125140
id-token: write
126141
steps:
127-
- uses: actions/checkout@v4
128-
with:
129-
fetch-depth: 0
130-
131-
- uses: actions/setup-python@v5
142+
- name: Download built packages from the check-package job.
143+
uses: actions/download-artifact@v4
132144
with:
133-
python-version: "3.x"
134-
135-
- name: Install dependencies
136-
run: |
137-
python -m pip install --upgrade pip
138-
pip install --upgrade build
139-
140-
- name: Build package
141-
run: python -m build --sdist --wheel --outdir dist/
142-
145+
name: Packages
146+
path: dist
143147
- name: Publish package
144148
uses: pypa/[email protected]
145149
with:

0 commit comments

Comments
 (0)