Skip to content

Commit 38c5d7e

Browse files
authored
Merge pull request #93 from bgilbert/checklist
Add basic pre-commit checks; autogenerate Markdown file with release checklist links
2 parents 54f83ae + b3ab095 commit 38c5d7e

File tree

6 files changed

+89
-1
lines changed

6 files changed

+89
-1
lines changed

.github/maintainer/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!-- Generated by mkmaintainer.py; do not edit -->
2+
3+
## Maintainer issue templates
4+
5+
- [Release checklist](https://github.com/openslide/openslide-java/issues/new?title=Release+X.Y.Z&body=%23+OpenSlide+Java+release+process%0A%0A-+%5B+%5D+Update+%60CHANGELOG.md%60+and+version+in+%60pom.xml%60%0A-+%5B+%5D+Create+and+push+signed+tag%0A-+%5B+%5D+Verify+that+GitHub+Actions+created+a+%5BGitHub+release%5D%28https%3A%2F%2Fgithub.com%2Fopenslide%2Fopenslide-java%2Freleases%29+with+release+notes+and+a+JAR%0A-+%5B+%5D+Update+website%3A+%60_data%2Freleases.yaml%60%2C+%60_includes%2Fnews.md%60%0A-+%5B+%5D+Send+mail+to+-announce+and+-users%0A-+%5B+%5D+Post+to+%5Bforum.image.sc%5D%28https%3A%2F%2Fforum.image.sc%2Fc%2Fannouncements%2F10%29&labels=release)

.github/maintainer/mkmaintainer.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
3+
from pathlib import Path
4+
from urllib.parse import urlencode
5+
6+
import yaml
7+
8+
dir = Path(__file__).parent
9+
with open(dir / 'README.md', 'w') as fh:
10+
fh.write('<!-- Generated by mkmaintainer.py; do not edit -->\n\n')
11+
fh.write('## Maintainer issue templates\n\n')
12+
for path in sorted(dir.iterdir()):
13+
if path.name == 'README.md' or path.suffix != '.md':
14+
continue
15+
_, front, body = path.read_text().split('---\n', 2)
16+
info = yaml.safe_load(front)
17+
args = urlencode(
18+
{
19+
'title': info['title'],
20+
'body': body.strip(),
21+
'labels': ','.join(info.get('labels', [])),
22+
}
23+
)
24+
url = f"https://github.com/{info['repo']}/issues/new?{args}"
25+
fh.write(f"- [{info['link-text']}]({url})\n")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
link-text: Release checklist
3+
repo: openslide/openslide-java
4+
title: Release X.Y.Z
5+
labels: [release]
6+
---
7+
18
# OpenSlide Java release process
29

310
- [ ] Update `CHANGELOG.md` and version in `pom.xml`

.github/workflows/java.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,22 @@ permissions:
1111
contents: read
1212

1313
jobs:
14+
pre-commit:
15+
name: Rerun pre-commit checks
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check out repo
19+
uses: actions/checkout@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.13'
24+
- name: Run pre-commit hooks
25+
uses: pre-commit/action@v3.0.1
26+
1427
build:
1528
name: Build
29+
needs: pre-commit
1630
runs-on: ${{ matrix.os }}
1731
outputs:
1832
dist-base: ${{ steps.dist.outputs.dist-base }}

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# exclude vendored files
2+
exclude: '^(COPYING\.LESSER)$'
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v6.0.0
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-merge-conflict
10+
- id: check-vcs-permalinks
11+
- id: check-yaml
12+
- id: end-of-file-fixer
13+
- id: fix-byte-order-marker
14+
- id: mixed-line-ending
15+
- id: trailing-whitespace
16+
17+
- repo: https://github.com/codespell-project/codespell
18+
rev: v2.4.1
19+
hooks:
20+
- id: codespell
21+
name: Check spelling with codespell
22+
additional_dependencies:
23+
- tomli # Python < 3.11
24+
25+
- repo: meta
26+
hooks:
27+
- id: check-hooks-apply
28+
- id: check-useless-excludes
29+
30+
- repo: local
31+
hooks:
32+
- id: mkmaintainer
33+
name: Sync maintainer issue templates
34+
entry: .github/maintainer/mkmaintainer.py
35+
files: .github/maintainer/
36+
language: python
37+
additional_dependencies: [PyYAML]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mvn
2525
The JAR will be in `target/openslide-java-*.jar`.
2626

2727
If you have multiple JVMs on your system, and Maven defaults to a version
28-
older than 22, you might need to set `JAVA_HOME`. For exmaple, on Fedora:
28+
older than 22, you might need to set `JAVA_HOME`. For example, on Fedora:
2929

3030
```
3131
JAVA_HOME=/usr/lib/jvm/java-22 mvn

0 commit comments

Comments
 (0)