Files
ai-job-search/tests/test_changelog_structure.py
T
Jakob Stender Guldberg 7f01d75251 ci: weekly SemVer releases with generated notes; freeze CHANGELOG.md at 1.7.4 (#800)
* ci: publish a weekly SemVer release with GitHub-generated notes

Every Monday at 06:00 UTC the workflow tags master and publishes a GitHub
Release whose notes list the merged PR titles. tools/next_version.py picks the
version from the commits since the last release: type!: or a BREAKING CHANGE
footer is major, feat is minor, anything else is patch. A manual run can
override it. Weeks without commits are skipped, a master commit whose CI did
not pass is never released, and forks never run it.

* docs: point contributors and forks at weekly GitHub Releases

PR titles are now the release notes and their type sets the version, so
CONTRIBUTING and the PR template say so. README and SETUP describe releases
as weekly checkpoints that passed CI instead of pointing at CHANGELOG.md.

* chore(changelog): freeze at 1.7.4 and fail PRs that still edit it

Rolls [Unreleased] into [1.7.4] and rewrites the intro to point at GitHub
Releases. The structure test becomes a content pin: stale PRs carry entries
that git would merge cleanly into the frozen section, so any edit now fails
CI with a pointer to the PR title.

* fix(release): address review findings on the weekly release

Write access moves to the job; the override rejects existing or older
versions; next_version.py reports a missing tag instead of a traceback and
drops the unused rev argument; tests pin the fork guard and SHA-pinned
checkout. The frozen changelog drops the date written ahead of the release,
describes its guard accurately, and the guard skips on forks.

* chore(changelog): re-pin the frozen hash after rebasing onto master

* ci(release): compute the version with commitizen via setup-uv instead of an in-repo script

A week of only docs, chore or ci commits now ships nothing on its own, matching commitizen's conventional-commit bump rules; fix, refactor and perf bump patch.
2026-10-31 14:28:12 +01:00

37 lines
1.6 KiB
Python

"""CHANGELOG.md is frozen at 1.7.4; releases after it are documented in GitHub Releases.
Every PR used to add an entry under `## [Unreleased]`, and PRs opened before the
freeze still carry one. Most of those entries sit mid-section, so git merges
them cleanly into the frozen 1.7.4 section - a heading check would not notice.
Pinning the file's content does: any edit fails here and points the author at
the PR title, which is what the release notes are generated from.
"""
import hashlib
import unittest
from pathlib import Path
try:
from tests._upstream import is_upstream_checkout
except ImportError: # `python -m unittest discover -s tests` imports test modules top-level
from _upstream import is_upstream_checkout
CHANGELOG = Path(__file__).resolve().parent.parent / "CHANGELOG.md"
FROZEN_SHA256 = "5a4f9ce8270ad872a3154fb872a7e287c27023d68a1b58c6415e2ec21b4b3815"
@unittest.skipIf(not is_upstream_checkout(), "the freeze guards the upstream changelog; forks may keep their own")
class FrozenChangelogTests(unittest.TestCase):
def test_changelog_is_unchanged(self):
# Line endings normalized so a CRLF checkout on Windows hashes the same.
content = CHANGELOG.read_bytes().replace(b"\r\n", b"\n")
self.assertEqual(
hashlib.sha256(content).hexdigest(), FROZEN_SHA256,
"CHANGELOG.md is frozen at 1.7.4: drop your edit and describe the change in the PR title "
"instead (release notes are generated from PR titles). A deliberate fix to the frozen text "
"updates FROZEN_SHA256 in the same PR.",
)
if __name__ == "__main__":
unittest.main()