Skip to content

Commit 1f8cbba

Browse files
A few more small CI tweaks (#4978)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 13721d9 commit 1f8cbba

File tree

11 files changed

+203
-92
lines changed

11 files changed

+203
-92
lines changed

.github/dependabot.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
22

33
version: 2
4+
45
updates:
56
- package-ecosystem: "github-actions"
67
# Workflow files in .github/workflows will be checked
78
directory: "/"
8-
schedule:
9-
interval: "weekly"
10-
labels: ["skip news", "C: dependencies"]
9+
labels: ["ci: skip news", "C: dependencies", "C: maintenance"]
10+
cooldown:
11+
default-days: 7
12+
13+
- package-ecosystem: "pip"
14+
directory: "/"
15+
labels: ["ci: skip news", "C: dependencies"]
16+
cooldown:
17+
default-days: 7
18+
19+
- package-ecosystem: "github-actions"
20+
directory: "/"
21+
patterns: ["pypa/cibuildwheel"]
22+
multi-ecosystem-group: "cibuildwheel"
1123
cooldown:
1224
default-days: 7
1325

1426
- package-ecosystem: "pip"
1527
directory: "/"
16-
schedule:
17-
interval: "weekly"
18-
labels: ["skip news", "C: dependencies"]
28+
patterns: ["cibuildwheel"]
29+
multi-ecosystem-group: "cibuildwheel"
1930
cooldown:
2031
default-days: 7
32+
33+
multi-ecosystem-groups:
34+
cibuildwheel:
35+
labels: ["ci: skip news", "C: dependencies"]

.github/workflows/changelog.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ jobs:
1717
persist-credentials: false
1818

1919
- name: Grep CHANGES.md for PR number
20-
if: contains(github.event.pull_request.labels.*.name, 'skip news') != true
20+
if: >
21+
contains(github.event.pull_request.labels.*.name, 'ci: skip news') != true
2122
run: |
2223
grep -Pz "\((\n\s*)?#${{ github.event.pull_request.number }}(\n\s*)?\)" CHANGES.md || \
23-
(echo "Please add '(#${{ github.event.pull_request.number }})' change line to CHANGES.md (or if appropriate, ask a maintainer to add the 'skip news' label)" && \
24+
(echo "Please add '(#${{ github.event.pull_request.number }})' change line to CHANGES.md (or if appropriate, ask a maintainer to add the 'ci: skip news' label)" && \
2425
exit 1)

.github/workflows/fuzz.yml

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,24 @@ name: fuzz
22

33
on:
44
push:
5-
paths:
6-
- tox.ini
7-
- .github/workflows/fuzz.yml
8-
- scripts/fuzz.py
9-
- src/**
10-
- tests/**
11-
- pyproject.toml
12-
5+
branches: main
136
pull_request:
147
paths:
15-
- tox.ini
168
- .github/workflows/fuzz.yml
179
- scripts/fuzz.py
18-
- src/**
19-
- tests/**
20-
- pyproject.toml
10+
schedule:
11+
- cron: "0 0 * * *"
12+
workflow_dispatch:
2113

2214
concurrency:
23-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2416
cancel-in-progress: true
2517

2618
permissions:
2719
contents: read
2820

2921
jobs:
3022
fuzz:
31-
# We want to run on external PRs, but not on our own internal PRs as they'll be run
32-
# by the push to the branch. Without this if check, checks are duplicated since
33-
# internal PRs match both the push and pull_request events.
34-
if:
35-
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
36-
github.repository
37-
3823
runs-on: ubuntu-latest
3924
strategy:
4025
fail-fast: false
@@ -55,4 +40,69 @@ jobs:
5540
pip-install: --group tox
5641

5742
- name: Run fuzz tests
58-
run: tox -e fuzz
43+
id: fuzz
44+
run: tox -e fuzz --result-json $python_ver
45+
env:
46+
python_ver: ${{ matrix.python-version }}
47+
48+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
49+
if: failure() && steps.fuzz.outcome == 'failure'
50+
with:
51+
name: ${{ matrix.python-version }}
52+
path: ${{ matrix.python-version }}
53+
54+
create-issue:
55+
runs-on: ubuntu-latest
56+
needs: fuzz
57+
if:
58+
github.repository == 'psf/black' && github.event_name != 'pull_request' &&
59+
failure()
60+
permissions:
61+
issues: write
62+
steps:
63+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
64+
with:
65+
merge-multiple: true
66+
path: ./output
67+
68+
- name: Generate issue data
69+
run: |
70+
output=issue-body.html
71+
touch $output
72+
for FILE in ./output/*; do
73+
echo "**Python $(basename $FILE)**" >> $output
74+
echo -e "\`\`\`py" >> $output
75+
echo -e "# stdout:" >> $output
76+
echo -e "$(jq .testenvs.fuzz.test[-1].output $FILE -r)\n" >> $output
77+
echo -e "# stderr:" >> $output
78+
echo -e "$(jq .testenvs.fuzz.test[-1].err $FILE -r)" >> $output
79+
echo -e "\`\`\`\n" >> $output
80+
done
81+
82+
- name: Get existing issue
83+
id: issue
84+
run: |
85+
echo "ISSUE=$( gh issue list \
86+
-A github-actions[bot] -l 'ci: fuzz error' \
87+
--json number -q .[0].number \
88+
-R $REPO )" >> $GITHUB_OUTPUT
89+
env:
90+
GITHUB_TOKEN: ${{ github.token }}
91+
REPO: ${{ github.repository }}
92+
93+
- name: Create new issue
94+
if: steps.issue.outputs.ISSUE == ''
95+
run: >
96+
gh issue create -t "Fuzz test failure" -F issue-body.html -l "ci: fuzz error"
97+
-R $REPO
98+
env:
99+
GITHUB_TOKEN: ${{ github.token }}
100+
REPO: ${{ github.repository }}
101+
102+
- name: Edit existing issue
103+
if: steps.issue.outputs.ISSUE != ''
104+
run: gh issue edit $ISSUE -F issue-body.html -R $REPO
105+
env:
106+
GITHUB_TOKEN: ${{ github.token }}
107+
REPO: ${{ github.repository }}
108+
ISSUE: ${{ steps.issue.outputs.ISSUE }}

.github/workflows/post_release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: post release
2+
3+
on:
4+
release:
5+
types: published
6+
7+
permissions: {}
8+
9+
jobs:
10+
update-stable:
11+
runs-on: ubuntu-latest
12+
if: github.event.release.prerelease != 'true'
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout stable branch
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
with:
20+
ref: stable
21+
fetch-depth: 0
22+
persist-credentials: true # needed for `git push` below
23+
24+
- name: Update stable branch to release tag & push
25+
run: |
26+
git reset --hard "${TAG_NAME}"
27+
git push
28+
env:
29+
TAG_NAME: ${{ github.event.release.tag_name }}
30+
31+
new-changelog:
32+
runs-on: ubuntu-latest
33+
if: github.event.release.prerelease != 'true'
34+
permissions:
35+
contents: write
36+
pull-requests: write
37+
steps:
38+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39+
with:
40+
ref: main
41+
fetch-tags: true
42+
persist-credentials: true # Needed for git-auto-commit-action
43+
44+
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
45+
with:
46+
python-version: "3.13"
47+
pip-version: "25.3"
48+
49+
- run: python scripts/release.py -a
50+
51+
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
52+
with:
53+
commit_message: Add new changelog
54+
branch: ci/new-changelog
55+
create_branch: true
56+
57+
- name: Create PR
58+
run: |
59+
gh pr create \
60+
-t "Add new changelog" -b "" \
61+
-l "ci: skip news" -l "C: maintanance" \
62+
-a $USER
63+
env:
64+
GITHUB_TOKEN: ${{ github.token }}
65+
USER: ${{ github.event.release.author.login }}

.github/workflows/pypi_upload.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ name: build and publish
22

33
on:
44
release:
5-
types: [published]
5+
types: published
66
pull_request:
77
push:
8-
branches:
9-
- main
8+
branches: main
109

1110
permissions: {}
1211

@@ -154,26 +153,3 @@ jobs:
154153
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
155154
with:
156155
verbose: true
157-
158-
update-stable:
159-
name: update stable branch
160-
needs: [publish-mypyc, publish-hatch]
161-
runs-on: ubuntu-latest
162-
if: github.event_name == 'release' && github.event.release.prerelease != 'true'
163-
permissions:
164-
contents: write
165-
166-
steps:
167-
- name: Checkout stable branch
168-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
169-
with:
170-
ref: stable
171-
fetch-depth: 0
172-
persist-credentials: true # needed for `git push` below
173-
174-
- name: Update stable branch to release tag & push
175-
run: |
176-
git reset --hard "${TAG_NAME}"
177-
git push
178-
env:
179-
TAG_NAME: ${{ github.event.release.tag_name }}

.pre-commit-config.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ repos:
1111
files: '(CHANGES\.md|source_version_control\.md)$'
1212
additional_dependencies:
1313
- beautifulsoup4>=4.14.2
14-
- commonmark==0.9.1
15-
- pyyaml==6.0.1
14+
- commonmark>=0.9.1
15+
- pyyaml>=6.0.1
1616

1717
- id: check-version-in-the-basics-example
1818
name: Check black version in the basics example
@@ -21,7 +21,7 @@ repos:
2121
files: '(CHANGES\.md|the_basics\.md)$'
2222
additional_dependencies:
2323
- beautifulsoup4>=4.14.2
24-
- commonmark==0.9.1
24+
- commonmark>=0.9.1
2525

2626
- repo: https://github.com/pycqa/isort
2727
rev: 8.0.0
@@ -33,7 +33,7 @@ repos:
3333
hooks:
3434
- id: flake8
3535
additional_dependencies:
36-
- flake8-bugbear==24.2.6
36+
- flake8-bugbear
3737
- flake8-comprehensions
3838
- flake8-simplify
3939
exclude: ^src/blib2to3/
@@ -47,11 +47,11 @@ repos:
4747
additional_dependencies:
4848
# Click is intentionally out-of-sync with pyproject.toml
4949
# v8.2 has breaking changes. We work around them at runtime, but we need the newer stubs.
50-
- click>=8.2.0
50+
- click>=8.0.0
5151
- packaging>=22.0
5252
- platformdirs>=2
53-
- pytokens>=0.3.0
54-
- tomli>=1.1.0,<2.0.0
53+
- pytokens~=0.4.0
54+
- tomli>=1.1.0
5555

5656
# blackd
5757
- aiohttp>=3.10
@@ -69,8 +69,8 @@ repos:
6969

7070
# version check
7171
- beautifulsoup4>=4.14.2
72-
- types-commonmark
73-
- types-pyyaml
72+
- types-commonmark>=0.9.0
73+
- types-pyyaml>=6.0.0
7474

7575
- repo: https://github.com/rbubley/mirrors-prettier
7676
rev: v3.8.1
@@ -83,6 +83,3 @@ repos:
8383
hooks:
8484
- id: end-of-file-fixer
8585
- id: trailing-whitespace
86-
87-
ci:
88-
autoupdate_schedule: weekly

docs/contributing/issue_triage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ We also have a few standalone labels:
8888
banners for first-time visitors to the repository)
8989
- **`help wanted`**: complex issues that need and are looking for a fair bit of work as
9090
to progress (will also show up in various GitHub pages)
91-
- **`skip news`**: for PRs that are trivial and don't need a CHANGELOG entry (and skips
92-
the CHANGELOG entry check)
91+
- **`ci: skip news`**: for PRs that are trivial and don't need a CHANGELOG entry (and
92+
skips the CHANGELOG entry check)
9393
- **`ci: build all wheels`**: when a full wheel build is needed, such as to debug
9494
platform-specific issues. Black does not build wheels for every platform on each pull
9595
request because the full build matrix is expensive. After the label is added, the
9696
workflow starts only when a new commit is pushed.
9797

9898
```{note}
99-
We do use labels for PRs, in particular the `skip news` label, but we aren't that
99+
We do use labels for PRs, in particular the `ci: skip news` label, but we aren't that
100100
rigorous about it. Just follow your judgement on what labels make sense for the specific
101101
PR (if any even make sense).
102102
```

0 commit comments

Comments
 (0)