Skip to content

Commit f8b85bf

Browse files
authored
Merge pull request #367 from pytest-dev/release-3.11.0
Release 3.11.0
2 parents 5818160 + b8ca8a6 commit f8b85bf

File tree

4 files changed

+77
-36
lines changed

4 files changed

+77
-36
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ on:
1010

1111
jobs:
1212

13-
deploy:
13+
package:
1414
runs-on: ubuntu-latest
15-
environment: deploy
16-
permissions:
17-
id-token: write # For PyPI trusted publishers.
18-
contents: write # For tag and release notes.
1915
env:
2016
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
2117

@@ -25,6 +21,17 @@ jobs:
2521
- name: Build and Check Package
2622
uses: hynek/[email protected]
2723

24+
deploy:
25+
needs: package
26+
runs-on: ubuntu-latest
27+
environment: deploy
28+
permissions:
29+
id-token: write # For PyPI trusted publishers.
30+
contents: write # For tag and release notes.
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
2835
- name: Download Package
2936
uses: actions/download-artifact@v3
3037
with:
@@ -36,7 +43,9 @@ jobs:
3643

3744
- name: Push tag
3845
run: |
39-
git tag v${{ github.event.inputs.version }} ${{ github.sha }}
46+
git config user.name "pytest bot"
47+
git config user.email "[email protected]"
48+
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
4049
git push origin v${{ github.event.inputs.version }}
4150
4251
- name: Set up Python
@@ -54,3 +63,5 @@ jobs:
5463
uses: softprops/action-gh-release@v1
5564
with:
5665
body_path: scripts/latest-release-notes.md
66+
files: dist/*
67+
tag_name: v${{ github.event.inputs.version }}

.github/workflows/test.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
name: test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "test-me-*"
8+
9+
pull_request:
10+
411

512
concurrency:
613
group: ${{ github.workflow }}-${{ github.ref }}
714
cancel-in-progress: true
815

916
jobs:
1017

18+
package:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Build and Check Package
23+
uses: hynek/[email protected]
24+
1125
test:
1226

27+
needs: [package]
28+
1329
runs-on: ${{ matrix.os }}
1430

1531
strategy:
@@ -31,21 +47,24 @@ jobs:
3147

3248
steps:
3349
- uses: actions/checkout@v3
50+
51+
- name: Download Package
52+
uses: actions/download-artifact@v3
53+
with:
54+
name: Packages
55+
path: dist
56+
3457
- name: Set up Python
3558
uses: actions/setup-python@v4
3659
with:
3760
python-version: ${{ matrix.python }}
61+
3862
- name: Install tox
3963
run: |
4064
python -m pip install --upgrade pip
4165
pip install tox
66+
4267
- name: Test
68+
shell: bash
4369
run: |
44-
tox -e ${{ matrix.tox_env }}
45-
46-
check-package:
47-
runs-on: ubuntu-latest
48-
steps:
49-
- uses: actions/checkout@v3
50-
- name: Build and Check Package
51-
uses: hynek/[email protected]
70+
tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Releases
22
========
33

4-
UNRELEASED
5-
----------
4+
3.11.1 (2023-06-15)
5+
-------------------
66

77
* Fixed introspection for failed ``assert_has_calls`` (`#365`_).
88

scripts/gen-release-notes.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
11
"""
22
Generates the release notes for the latest release, in Markdown.
33
4-
Convert CHANGELOG.rst to Markdown, and extracts just the latest release.
5-
6-
Writes to ``scripts/latest-release-notes.md``, which can be
7-
used with https://github.com/softprops/action-gh-release.
4+
1. Extracts the latest release from the CHANGELOG.rst file.
5+
2. Converts it to Markdown using pypandoc.
6+
3. Writes to ``scripts/latest-release-notes.md``, which can be
7+
used with https://github.com/softprops/action-gh-release.
88
"""
99
from pathlib import Path
1010

1111
import pypandoc
1212

1313
this_dir = Path(__file__).parent
1414
rst_text = (this_dir.parent / "CHANGELOG.rst").read_text(encoding="UTF-8")
15-
md_text = pypandoc.convert_text(
16-
rst_text, "md", format="rst", extra_args=["--wrap=preserve"]
17-
)
1815

1916
output_lines = []
20-
first_heading_found = False
21-
for line in md_text.splitlines():
22-
if line.startswith("# "):
23-
# Skip the first section (normally # Releases).
24-
pass
25-
elif line.startswith("## "):
26-
# First second-level section, note it and skip the text,
27-
# as we are only interested in the individual release items.
28-
if first_heading_found:
17+
capture = False
18+
for line in rst_text.splitlines():
19+
# Only start capturing after the latest release section.
20+
if line.startswith("-------"):
21+
capture = not capture
22+
if not capture:
23+
# We only need to capture the latest release, so stop.
2924
break
30-
first_heading_found = True
31-
else:
25+
continue
26+
27+
if capture:
3228
output_lines.append(line)
3329

30+
# Drop last line, as it contains the previous release section title.
31+
del output_lines[-1]
32+
33+
trimmed_rst = "\n".join(output_lines).strip()
34+
print(">>Trimmed RST follows:")
35+
print(trimmed_rst)
36+
print(">>Trimmed RST ends")
37+
38+
md_text = pypandoc.convert_text(
39+
trimmed_rst, "md", format="rst", extra_args=["--wrap=preserve"]
40+
)
41+
print(">>Converted Markdown follows:")
42+
print(md_text)
43+
print(">>Converted Markdown ends")
44+
3445
output_fn = this_dir / "latest-release-notes.md"
35-
output_fn.write_text("\n".join(output_lines), encoding="UTF-8")
46+
output_fn.write_text(md_text, encoding="UTF-8")
3647
print(output_fn, "generated.")

0 commit comments

Comments
 (0)