diff --git a/.claude/rules/changelog.md b/.claude/rules/changelog.md index d636fec39d..60fcb7bc69 100644 --- a/.claude/rules/changelog.md +++ b/.claude/rules/changelog.md @@ -7,8 +7,8 @@ paths: # Changelog -- A user-visible change adds one towncrier fragment to its app, `apple/changelog.d/..md` or `linux/changelog.d/..md`, where `` is the pull request that adds it. A second entry of one type adds a counter: `3452.fixed.1.md`. +- A user-visible change adds one towncrier fragment to its app, `apple/changelog.d/..md`, `linux/changelog.d/..md` or `windows/changelog.d/..md`, where `` is the pull request that adds it. A second entry of one type adds a counter: `3452.fixed.1.md`. - `` is `added`, `changed`, `deprecated`, `removed`, `fixed` or `security`. - One sentence per entry, in the user's terms, at most 120 characters, ending with a period. Fixed names the bug, not the fix. No bullet, PR link or credit: towncrier and `notes.py` add them. -- Only a `chore(release)` pull request edits `apple/CHANGELOG.md` or `linux/CHANGELOG.md`; `scripts/ci/check-changelog-edits.sh` refuses any other, in CI's Lint job and in PR title. -- The release, the lead and `[CRITICAL]`: `apple/RELEASING.md`, Notes, and `linux/docs/releasing.md`. +- Only a `chore(release)` pull request edits `apple/CHANGELOG.md`, `linux/CHANGELOG.md` or `windows/CHANGELOG.md`; `scripts/ci/check-changelog-edits.sh` refuses any other, in CI's Lint job and in PR title. +- The release, the lead and `[CRITICAL]`: `apple/RELEASING.md`, Notes, `linux/docs/releasing.md` and `windows/RELEASING.md`. diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 0739d638a8..5c21591342 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -110,6 +110,7 @@ jobs: set -euo pipefail "$RUNNER_TEMP/release-venv/bin/towncrier" build --draft --dir apple --version 0.0.0 "$RUNNER_TEMP/release-venv/bin/towncrier" build --draft --dir linux --version 0.0.0 + "$RUNNER_TEMP/release-venv/bin/towncrier" build --draft --dir windows --version 0.0.0 # pr-title.yml runs the same check on a title edit, which starts no CI run. The title is read now, not from the # event, so a re-run after a retitle sees the current one. diff --git a/scripts/ci/check-changelog-edits.sh b/scripts/ci/check-changelog-edits.sh index da9c36194a..410eaefd59 100755 --- a/scripts/ci/check-changelog-edits.sh +++ b/scripts/ci/check-changelog-edits.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash set -euo pipefail -# Fails when the changes from to HEAD edit apple/CHANGELOG.md or linux/CHANGELOG.md and is not a -# chore(release) title. A version heading added outside a release PR makes version.py refuse its betas and notes.py -# assemble refuse it. +# Fails when the changes from <base> to HEAD edit apple/CHANGELOG.md, linux/CHANGELOG.md or windows/CHANGELOG.md and +# <title> is not a chore(release) title. A version heading added outside a release PR makes version.py refuse its betas +# and notes.py assemble refuse it. # Usage: check-changelog-edits.sh <base> <title> if [ $# -ne 2 ] || [ -z "$1" ]; then @@ -14,7 +14,9 @@ BASE="$1" TITLE="$2" cd "$(git rev-parse --show-toplevel)" -edited="$(git diff --no-renames --name-only "$BASE" HEAD -- apple/CHANGELOG.md linux/CHANGELOG.md)" +# --diff-filter=a excludes an added file: bootstrapping an app's empty CHANGELOG.md once carries no version heading, so +# any PR may add it; every later edit to it is caught. +edited="$(git diff --no-renames --diff-filter=a --name-only "$BASE" HEAD -- apple/CHANGELOG.md linux/CHANGELOG.md windows/CHANGELOG.md)" [ -n "$edited" ] || exit 0 case "$TITLE" in 'chore(release)'*) exit 0 ;; esac echo "::error title=Changelog::Only a chore(release) pull request edits ${edited//$'\n'/ or }. Add a changelog.d/<PR>.<type>.md fragment instead." diff --git a/scripts/ci/test_check_changelog_edits.py b/scripts/ci/test_check_changelog_edits.py index 05000a5c0b..3e089159f8 100644 --- a/scripts/ci/test_check_changelog_edits.py +++ b/scripts/ci/test_check_changelog_edits.py @@ -19,7 +19,9 @@ def setUp(self): self.git("-c", "init.defaultBranch=main", "init", "-q") (self.repo / "scripts/ci").mkdir(parents=True) shutil.copy(SCRIPT, self.repo / "scripts/ci/check-changelog-edits.sh") - self.base = self.commit(["apple/CHANGELOG.md", "linux/CHANGELOG.md", "README.md"]) + self.base = self.commit( + ["apple/CHANGELOG.md", "linux/CHANGELOG.md", "windows/CHANGELOG.md", "README.md"] + ) def tearDown(self): self.temp.cleanup() @@ -53,7 +55,7 @@ def test_a_change_without_a_changelog_passes_under_any_title(self): self.assertEqual(self.check("fix(editor): keep the caret")[0], 0) def test_a_changelog_edit_fails_outside_a_release_title(self): - for path in ["apple/CHANGELOG.md", "linux/CHANGELOG.md"]: + for path in ["apple/CHANGELOG.md", "linux/CHANGELOG.md", "windows/CHANGELOG.md"]: with self.subTest(path=path): self.git("reset", "-q", "--hard", self.base) self.commit([path]) @@ -61,12 +63,12 @@ def test_a_changelog_edit_fails_outside_a_release_title(self): self.assertEqual(status, 1) self.assertIn(f"::error title=Changelog::Only a chore(release) pull request edits {path}", out) - def test_both_changelogs_are_named_in_one_line(self): - self.commit(["apple/CHANGELOG.md", "linux/CHANGELOG.md"]) + def test_every_changelog_is_named_in_one_line(self): + self.commit(["apple/CHANGELOG.md", "linux/CHANGELOG.md", "windows/CHANGELOG.md"]) status, out = self.check("docs: notes") self.assertEqual(status, 1) self.assertEqual(len(out.splitlines()), 1) - self.assertIn("apple/CHANGELOG.md or linux/CHANGELOG.md", out) + self.assertIn("apple/CHANGELOG.md or linux/CHANGELOG.md or windows/CHANGELOG.md", out) def test_a_release_title_may_edit_a_changelog(self): self.commit(["apple/CHANGELOG.md"]) @@ -76,6 +78,13 @@ def test_a_title_naming_release_elsewhere_is_not_a_release_title(self): self.commit(["apple/CHANGELOG.md"]) self.assertEqual(self.check("fix: chore(release) notes")[0], 1) + def test_adding_a_new_changelog_passes_under_any_title(self): + self.git("rm", "-q", "windows/CHANGELOG.md") + self.git("commit", "-q", "-m", "remove") + base = self.git("rev-parse", "HEAD") + self.commit(["windows/CHANGELOG.md"]) + self.assertEqual(self.check("chore(windows): bootstrap changelog", base=base)[0], 0) + def test_an_empty_base_is_a_usage_error(self): self.assertEqual(self.check("fix: x", base="")[0], 2) diff --git a/windows/AGENTS.md b/windows/AGENTS.md index 8d43c9ea6d..60e4a15ed4 100644 --- a/windows/AGENTS.md +++ b/windows/AGENTS.md @@ -33,7 +33,7 @@ This is the guide for work under `windows/`. The root `AGENTS.md` holds the rule - `scripts/engine-glyphs.py`: writes `src/TablePro.App/Resources/EngineGlyphs.xaml` from the macOS app's engine artwork. Run it after that artwork changes or an engine is added. - `scripts/package-assets.py`: writes the MSIX logos in `src/TablePro.App/Assets` from the app icon. Run it after the icon changes. - `scripts/editor-schemes.py`: writes `src/TablePro.Editor.Model/ColorSchemes.Themes.cs`, the editor's color schemes, from the macOS app's built-in themes. Run it after a theme changes. -- `RELEASING.md`: how a release is built, signed, published and sent to winget. +- `RELEASING.md`: how a release is built, signed, published and sent to winget. `CHANGELOG.md` and `changelog.d/`: the towncrier notes (`.claude/rules/changelog.md`). - `docs/decisions/`: the decisions only the Windows app makes. - The core's side of the boundary: `core/crates/ffi` (`core/ARCHITECTURE.md`, Bindings). @@ -107,9 +107,10 @@ Pass `-p:UniffiBindgenCs=<path>` when it is not on `PATH`; the target refuses an ## Every change 1. **Tests.** Behavior of the interop library gets a test in `tests/` against a real database file. Behavior of the core gets its Rust test in `core/crates/ffi`. -2. **Strings.** Every word the app shows is in `src/TablePro.App/Strings/en-US/Resources.resw`: `x:Uid` in XAML, `Strings.Get`, `Format` or `Plural` in the app, `HostStrings` in a control. A count takes `Plural` and `{n:N0}`, never a comparison with one, and a join of words is a string too (`docs/decisions/0021-localization.md`). `LocalizationTests` fails on the common shapes; a literal a helper passes on to a control is the review's to catch. -3. **Code style.** `.editorconfig` and the analyzers; a warning fails the build. A comment is one `//` line that says why, never what: no XML doc and no multi-line block. -4. **Commits and pull requests** follow the root rules, with scope `windows` or `windows-<area>`. +2. **Changelog.** A user-visible change adds `changelog.d/<PR>.<type>.md`; only a release PR edits `CHANGELOG.md` (`.claude/rules/changelog.md`). +3. **Strings.** Every word the app shows is in `src/TablePro.App/Strings/en-US/Resources.resw`: `x:Uid` in XAML, `Strings.Get`, `Format` or `Plural` in the app, `HostStrings` in a control. A count takes `Plural` and `{n:N0}`, never a comparison with one, and a join of words is a string too (`docs/decisions/0021-localization.md`). `LocalizationTests` fails on the common shapes; a literal a helper passes on to a control is the review's to catch. +4. **Code style.** `.editorconfig` and the analyzers; a warning fails the build. A comment is one `//` line that says why, never what: no XML doc and no multi-line block. +5. **Commits and pull requests** follow the root rules, with scope `windows` or `windows-<area>`. ## CI diff --git a/windows/CHANGELOG.md b/windows/CHANGELOG.md new file mode 100644 index 0000000000..ede5f77841 --- /dev/null +++ b/windows/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +All notable changes to TablePro for Windows will be documented in this file. + +The format is based on [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +Unreleased changes are files in `changelog.d/`. + +<!-- towncrier release notes start --> diff --git a/windows/RELEASING.md b/windows/RELEASING.md index cb30c273f4..cc432eb839 100644 --- a/windows/RELEASING.md +++ b/windows/RELEASING.md @@ -64,6 +64,19 @@ The maintainer does these once, in this order: a tag runs the workflow file at t - For a release, opens the winget-pkgs pull request with wingetcreate, which a reviewer approves. 4. **Afterwards**: check that `https://updates.tablepro.app/windows/TablePro.appinstaller` (or `TablePro-Beta.appinstaller`) names the new version, and watch the winget-pkgs pull request. Its bots validate and install the package, and a label such as `Needs-Author-Feedback` waits for an answer. +## Notes + +- A user-visible change adds one towncrier fragment, `windows/changelog.d/<PR>.<type>.md` (`.claude/rules/changelog.md`). Only a `chore(release)` pull request edits `windows/CHANGELOG.md`; CI's Lint job refuses any other. +- The release pull request assembles the fragments into a `CHANGELOG.md` section and curates them, as the macOS app does (`apple/RELEASING.md`, Notes). From a venv built on `scripts/release/requirements.txt`: + + ```bash + towncrier build --dir windows --version X.Y.Z + ``` + + `[CRITICAL]` on the version heading marks a security or data-loss release, never a beta; later stables carry it forward. +- A beta gets no `CHANGELOG.md` section: its notes are a towncrier draft of the fragments at the tag (`towncrier build --draft --dir windows --version X.Y.Z-beta.N`). +- The GitHub release body the workflow writes is a fixed install line, not the changelog. + ## When a run fails - Nothing reaches users before the GitHub release job. Tags never move: a code fix lands on `main` and ships as the next number. diff --git a/windows/changelog.d/.gitkeep b/windows/changelog.d/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/windows/towncrier.toml b/windows/towncrier.toml new file mode 100644 index 0000000000..c88d28c617 --- /dev/null +++ b/windows/towncrier.toml @@ -0,0 +1,27 @@ +[tool.towncrier] +filename = "CHANGELOG.md" +directory = "changelog.d" +start_string = "<!-- towncrier release notes start -->\n" +title_format = "## [{version}](https://github.com/TableProApp/TablePro/releases/tag/windows-v{version}) - {project_date}" +issue_format = "[#{issue}](https://github.com/TableProApp/TablePro/pull/{issue})" +underlines = ["", "", ""] +ignore = [] +issue_pattern = "\\d+" + +[[tool.towncrier.type]] +name = "Added" + +[[tool.towncrier.type]] +name = "Changed" + +[[tool.towncrier.type]] +name = "Deprecated" + +[[tool.towncrier.type]] +name = "Removed" + +[[tool.towncrier.type]] +name = "Fixed" + +[[tool.towncrier.type]] +name = "Security"