From cb5c8574f51038b4a9bf0096a9b9ea6abd4a869e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 30 May 2023 14:30:08 +0930 Subject: [PATCH] doc: allow commits to suppress the schema checks. The stupid requirement for JSON commas combines with our inability to annotate the removal or introduction of enum values and our naive check here, to produce a false positive. Allow commit messages to suppress. No-schema-diff-check: removed enum `websocket` as value type. Signed-off-by: Rusty Russell --- doc/Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 34b26a8b113f..0975428c6dc5 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -230,18 +230,23 @@ doc/index.rst: $(MANPAGES:=.md) # For CI to (very roughly!) check that we only deprecated fields, or labelled added ones # When running on GitHub (CI=true), we need to fetch origin/master schema-added-check: - @if ! test -z $$CI; then git fetch origin master; fi; \ - if git diff origin/master -- doc/schemas | grep -q '^+.*{' && ! git diff origin/master -- doc/schemas | grep -q '^+.*"added"'; then \ - git diff origin/master -- doc/schemas; \ + @if ! test -z $$CI; then git fetch origin master; ROOT=FETCH_HEAD; else ROOT=master; fi; \ + if git show --format=%B -s $$ROOT.. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \ + if git diff $$ROOT -- doc/schemas | grep -q '^+.*{' && ! git diff $$ROOT -- doc/schemas | grep -q '^+.*"added"'; then \ + git diff $$ROOT -- doc/schemas; \ echo 'New schema fields must have "added": "vNEXTVERSION"' >&2; exit 1; \ fi schema-removed-check: - @if ! test -z $$CI; then git fetch origin master; fi; \ - if git diff origin/master -- doc/schemas | grep -q '^-.*{' && ! git diff origin/master -- doc/schemas | grep -q '^-.*"deprecated"' && ! git diff origin/master -- doc/schemas | grep -q '^-.*EXPERIMENTAL_FEATURES'; then \ - git diff origin/master -- doc/schemas ; \ + @if ! test -z $$CI; then git fetch origin master; ROOT=FETCH_HEAD; else ROOT=master; fi; \ + if git show --format=%B -s $$ROOT.. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \ + if git diff $$ROOT -- doc/schemas | grep -q '^-.*{' && ! git diff $$ROOT -- doc/schemas | grep -q '^-.*"deprecated"' && ! git diff $$ROOT -- doc/schemas | grep -q '^-.*EXPERIMENTAL_FEATURES'; then \ + git diff $$ROOT -- doc/schemas ; \ echo 'Schema fields must be "deprecated", with version, not removed' >&2; exit 1; \ fi -schema-diff-check: schema-added-check schema-removed-check +show-diff: + @if ! test -z $$CI; then git fetch origin master; ROOT=FETCH_HEAD; else ROOT=master; fi; echo "DIFF from $$ROOT to here:"; git show --format=%B $$ROOT.. + +schema-diff-check: show-diff schema-added-check schema-removed-check check-source: schema-diff-check