Skip to content

Commit

Permalink
doc: allow commits to suppress the schema checks.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell committed May 30, 2023
1 parent 9e2ec0d commit cb5c857
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cb5c857

Please sign in to comment.