Skip to content

Commit a28c08e

Browse files
authored
Merge pull request #13875 from bluetech/ci-tweaks
CI tweaks
2 parents 76910ca + a250954 commit a28c08e

File tree

7 files changed

+79
-44
lines changed

7 files changed

+79
-44
lines changed

.github/workflows/deploy.yml

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,52 @@ jobs:
3535
with:
3636
attest-build-provenance-github: 'true'
3737

38-
deploy:
39-
if: github.repository == 'pytest-dev/pytest'
38+
generate-gh-release-notes:
4039
needs: [package]
4140
runs-on: ubuntu-latest
42-
environment: deploy
4341
timeout-minutes: 30
4442
permissions:
45-
id-token: write
46-
contents: write
43+
contents: read
4744
steps:
4845
- uses: actions/checkout@v5
4946
with:
50-
persist-credentials: true
47+
fetch-depth: 0
48+
persist-credentials: false
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v6
52+
with:
53+
python-version: "3.13"
54+
55+
- name: Install tox
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install --upgrade tox
5159
60+
- name: Generate release notes
61+
env:
62+
VERSION: ${{ github.event.inputs.version }}
63+
run: |
64+
tox -e generate-gh-release-notes -- "$VERSION" gh-release-notes.md
65+
66+
- name: Upload release notes
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: release-notes
70+
path: gh-release-notes.md
71+
retention-days: 1
72+
73+
publish-to-pypi:
74+
if: github.repository == 'pytest-dev/pytest'
75+
# Need generate-gh-release-notes only for ordering.
76+
# Don't want to release to PyPI if generating GitHub release notes fails.
77+
needs: [package, generate-gh-release-notes]
78+
runs-on: ubuntu-latest
79+
environment: deploy
80+
timeout-minutes: 30
81+
permissions:
82+
id-token: write
83+
steps:
5284
- name: Download Package
5385
uses: actions/download-artifact@v6
5486
with:
@@ -60,6 +92,18 @@ jobs:
6092
with:
6193
attestations: true
6294

95+
push-tag:
96+
needs: [publish-to-pypi]
97+
runs-on: ubuntu-latest
98+
timeout-minutes: 10
99+
permissions:
100+
contents: write
101+
steps:
102+
- uses: actions/checkout@v5
103+
with:
104+
fetch-depth: 0
105+
persist-credentials: true
106+
63107
- name: Push tag
64108
env:
65109
VERSION: ${{ github.event.inputs.version }}
@@ -69,48 +113,28 @@ jobs:
69113
git tag --annotate --message=v"$VERSION" "$VERSION" ${{ github.sha }}
70114
git push origin "$VERSION"
71115
72-
release-notes:
73-
74-
# todo: generate the content in the build job
75-
# the goal being of using a github action script to push the release data
76-
# after success instead of creating a complete python/tox env
77-
needs: [deploy]
116+
create-github-release:
117+
needs: [push-tag, generate-gh-release-notes]
78118
runs-on: ubuntu-latest
79-
timeout-minutes: 30
119+
timeout-minutes: 10
80120
permissions:
81121
contents: write
82122
steps:
83-
- uses: actions/checkout@v5
84-
with:
85-
fetch-depth: 0
86-
persist-credentials: false
87-
88123
- name: Download Package
89124
uses: actions/download-artifact@v6
90125
with:
91126
name: Packages
92127
path: dist
93128

94-
- name: Set up Python
95-
uses: actions/setup-python@v6
129+
- name: Download release notes
130+
uses: actions/download-artifact@v6
96131
with:
97-
python-version: "3.11"
98-
99-
- name: Install tox
100-
run: |
101-
python -m pip install --upgrade pip
102-
pip install --upgrade tox
103-
104-
- name: Generate release notes
105-
env:
106-
VERSION: ${{ github.event.inputs.version }}
107-
run: |
108-
sudo apt-get install pandoc
109-
tox -e generate-gh-release-notes -- "$VERSION" scripts/latest-release-notes.md
132+
name: release-notes
133+
path: .
110134

111135
- name: Publish GitHub Release
112136
env:
113137
VERSION: ${{ github.event.inputs.version }}
114138
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115139
run: |
116-
gh release create --notes-file scripts/latest-release-notes.md --verify-tag "$VERSION" dist/*
140+
gh release create --notes-file gh-release-notes.md --verify-tag "$VERSION" dist/*

.github/workflows/doc-check-links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Python
2626
uses: actions/setup-python@v6
2727
with:
28-
python-version: "3.11"
28+
python-version: "3.13"
2929
cache: pip
3030

3131
- name: Install dependencies

.github/workflows/prepare-release-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up Python
3737
uses: actions/setup-python@v6
3838
with:
39-
python-version: "3.x"
39+
python-version: "3.13"
4040

4141
- name: Install dependencies
4242
run: |

.github/workflows/update-plugin-list.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ jobs:
2828
- name: Setup Python
2929
uses: actions/setup-python@v6
3030
with:
31-
python-version: "3.11"
32-
cache: pip
31+
python-version: "3.13"
3332

3433
- name: requests-cache
3534
uses: actions/cache@v4
@@ -38,13 +37,13 @@ jobs:
3837
key: plugins-http-cache-${{ github.run_id }} # Can use time based key as well
3938
restore-keys: plugins-http-cache-
4039

41-
- name: Install dependencies
40+
- name: Install tox
4241
run: |
4342
python -m pip install --upgrade pip
44-
pip install packaging requests tabulate[widechars] tqdm requests-cache platformdirs
43+
pip install --upgrade tox
4544
4645
- name: Update Plugin List
47-
run: python scripts/update-plugin-list.py
46+
run: tox -e update-plugin-list
4847

4948
- name: Create Pull Request
5049
id: pr

RELEASING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Releasing
133133

134134
Both automatic and manual processes described above follow the same steps from this point onward.
135135

136-
#. After all tests pass and the PR has been approved, trigger the ``deploy`` job
136+
#. After all tests pass and the PR has been approved, trigger the ``deploy`` workflow
137137
in https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml, using the ``release-MAJOR.MINOR.PATCH`` branch
138138
as source.
139139

scripts/generate-gh-release-notes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def extract_changelog_entries_for(version: str) -> str:
4343

4444
def convert_rst_to_md(text: str) -> str:
4545
result = pypandoc.convert_text(
46-
text, "md", format="rst", extra_args=["--wrap=preserve"]
46+
text, "gfm", format="rst", extra_args=["--wrap=preserve"]
4747
)
4848
assert isinstance(result, str), repr(result)
4949
return result

tox.ini

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,17 @@ commands = python scripts/prepare-release-pr.py {posargs}
212212
description = generate release notes that can be published as GitHub Release
213213
usedevelop = True
214214
deps =
215-
pypandoc
215+
pypandoc_binary
216216
commands = python scripts/generate-gh-release-notes.py {posargs}
217+
218+
[testenv:update-plugin-list]
219+
description = update the plugin list
220+
skip_install = True
221+
deps =
222+
packaging
223+
requests
224+
tabulate[widechars]
225+
tqdm
226+
requests-cache
227+
platformdirs
228+
commands = python scripts/update-plugin-list.py {posargs}

0 commit comments

Comments
 (0)