Skip to content

Commit 948595e

Browse files
committed
Use hynek/build-and-inspect-python-package for packaging
All environments will properly test the exact same package. Also enable PyPI trusted publishing.
1 parent e17ac22 commit 948595e

File tree

3 files changed

+46
-19
lines changed

3 files changed

+46
-19
lines changed

.github/workflows/deploy.yml

+23-15
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,38 @@ on:
77

88
jobs:
99

10+
package:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Build and Check Package
15+
uses: hynek/[email protected]
16+
1017
deploy:
18+
needs: [package]
19+
1120
if: github.repository == 'pytest-dev/pytest-qt'
1221

1322
runs-on: ubuntu-latest
1423

24+
permissions:
25+
id-token: write # For PyPI trusted publishers.
26+
contents: write # For release.
27+
1528
steps:
1629
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
19-
persist-credentials: false
2030

21-
- name: Set up Python
22-
uses: actions/setup-python@v3
31+
- name: Download Package
32+
uses: actions/download-artifact@v3
2333
with:
24-
python-version: "3.x"
25-
26-
- name: Build package
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install build
30-
python -m build
34+
name: Packages
35+
path: dist
3136

3237
- name: Publish package to PyPI
33-
uses: pypa/[email protected]
38+
uses: pypa/[email protected]
39+
40+
- name: GitHub Release
41+
uses: softprops/action-gh-release@v1
3442
with:
35-
user: __token__
36-
password: ${{ secrets.pypi_token }}
43+
body_path: scripts/latest-release-notes.md
44+
files: dist/*

.github/workflows/test.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ concurrency:
88
cancel-in-progress: true
99

1010
jobs:
11-
build:
11+
package:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Build and Check Package
16+
uses: hynek/[email protected]
17+
18+
test:
19+
20+
needs: [package]
1221

1322
runs-on: ${{ matrix.os }}
1423
strategy:
@@ -40,12 +49,19 @@ jobs:
4049

4150
steps:
4251
- uses: actions/checkout@v3
52+
4353
- name: Set up Python ${{ matrix.python-version }}
4454
uses: actions/setup-python@v3
4555
with:
4656
python-version: ${{ matrix.python-version }}
4757

48-
- name: Install dependencies
58+
- name: Download Package
59+
uses: actions/download-artifact@v3
60+
with:
61+
name: Packages
62+
path: dist
63+
64+
- name: Install Dependencies
4965
run: |
5066
python -m pip install --upgrade pip
5167
pip install tox
@@ -54,6 +70,8 @@ jobs:
5470
sudo apt-get install -y libgles2-mesa-dev
5571
fi
5672
shell: bash
57-
- name: Test with tox
73+
74+
- name: Test
75+
shell: bash
5876
run: |
59-
tox -e ${{ matrix.tox-env }}-${{ matrix.qt-lib }} -- -ra --color=yes
77+
tox -e ${{ matrix.tox-env }}-${{ matrix.qt-lib }} --installpkg `find dist/*.tar.gz` -- -ra

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
author_email="[email protected]",
1919
description="pytest support for PyQt and PySide applications",
2020
long_description=Path("README.rst").read_text(encoding="UTF-8"),
21+
long_description_content_type="text/x-rst",
2122
license="MIT",
2223
keywords="pytest qt test unittest",
2324
url="http://github.com/pytest-dev/pytest-qt",

0 commit comments

Comments
 (0)