diff --git a/.github/maintainer/README.md b/.github/maintainer/README.md new file mode 100644 index 0000000..420c9d4 --- /dev/null +++ b/.github/maintainer/README.md @@ -0,0 +1,5 @@ + + +## Maintainer issue templates + +- [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) diff --git a/.github/maintainer/mkmaintainer.py b/.github/maintainer/mkmaintainer.py new file mode 100755 index 0000000..050229d --- /dev/null +++ b/.github/maintainer/mkmaintainer.py @@ -0,0 +1,25 @@ +#!/usr/bin/python + +from pathlib import Path +from urllib.parse import urlencode + +import yaml + +dir = Path(__file__).parent +with open(dir / 'README.md', 'w') as fh: + fh.write('\n\n') + fh.write('## Maintainer issue templates\n\n') + for path in sorted(dir.iterdir()): + if path.name == 'README.md' or path.suffix != '.md': + continue + _, front, body = path.read_text().split('---\n', 2) + info = yaml.safe_load(front) + args = urlencode( + { + 'title': info['title'], + 'body': body.strip(), + 'labels': ','.join(info.get('labels', [])), + } + ) + url = f"https://github.com/{info['repo']}/issues/new?{args}" + fh.write(f"- [{info['link-text']}]({url})\n") diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/maintainer/release.md similarity index 80% rename from .github/ISSUE_TEMPLATE/release.md rename to .github/maintainer/release.md index 7465e1e..dcddc4d 100644 --- a/.github/ISSUE_TEMPLATE/release.md +++ b/.github/maintainer/release.md @@ -1,3 +1,10 @@ +--- +link-text: Release checklist +repo: openslide/openslide-java +title: Release X.Y.Z +labels: [release] +--- + # OpenSlide Java release process - [ ] Update `CHANGELOG.md` and version in `pom.xml` diff --git a/.github/workflows/java.yaml b/.github/workflows/java.yaml index ee2c3ab..aef3166 100644 --- a/.github/workflows/java.yaml +++ b/.github/workflows/java.yaml @@ -11,8 +11,22 @@ permissions: contents: read jobs: + pre-commit: + name: Rerun pre-commit checks + runs-on: ubuntu-latest + steps: + - name: Check out repo + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + - name: Run pre-commit hooks + uses: pre-commit/action@v3.0.1 + build: name: Build + needs: pre-commit runs-on: ${{ matrix.os }} outputs: dist-base: ${{ steps.dist.outputs.dist-base }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..09dd3d6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,37 @@ +# exclude vendored files +exclude: '^(COPYING\.LESSER)$' + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-added-large-files + - id: check-merge-conflict + - id: check-vcs-permalinks + - id: check-yaml + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: trailing-whitespace + + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + name: Check spelling with codespell + additional_dependencies: + - tomli # Python < 3.11 + + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + + - repo: local + hooks: + - id: mkmaintainer + name: Sync maintainer issue templates + entry: .github/maintainer/mkmaintainer.py + files: .github/maintainer/ + language: python + additional_dependencies: [PyYAML] diff --git a/README.md b/README.md index de0b9dc..7ca2eb9 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ mvn The JAR will be in `target/openslide-java-*.jar`. If you have multiple JVMs on your system, and Maven defaults to a version -older than 22, you might need to set `JAVA_HOME`. For exmaple, on Fedora: +older than 22, you might need to set `JAVA_HOME`. For example, on Fedora: ``` JAVA_HOME=/usr/lib/jvm/java-22 mvn