mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-11 01:27:58 +01:00
doc/Makefile: restore CI check for schema changes.
We now know the base reference, and we've rebased, so we can do a simple diff. Also, this means we can use a magic commit message `No-schema-diff-check` to suppress false positives. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
e0d2c39565
commit
50a7681171
1 changed files with 10 additions and 10 deletions
20
doc/Makefile
20
doc/Makefile
|
@ -227,22 +227,22 @@ doc/index.rst: $(MANPAGES:=.md)
|
|||
python3 devtools/blockreplace.py doc/index.rst manpages --language=rst --indent " " \
|
||||
)
|
||||
|
||||
# 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
|
||||
# Overridden by GH CI if necessary.
|
||||
BASE_REF=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 git show --format=%B -s $(BASE_REF).. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \
|
||||
if git diff $(BASE_REF) -- doc/schemas | grep -q '^+.*{' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^+.*"added"'; then \
|
||||
git diff $(BASE_REF) -- 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 git show --format=%B -s $(BASE_REF).. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \
|
||||
if git diff $(BASE_REF) -- doc/schemas | grep -q '^-.*{' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^-.*"deprecated"' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^-.*EXPERIMENTAL_FEATURES'; then \
|
||||
git diff $(BASE_REF) -- 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
|
||||
|
||||
# This breaks current commit; will revert after.
|
||||
#check-source: schema-diff-check
|
||||
check-source: schema-diff-check
|
||||
|
|
Loading…
Add table
Reference in a new issue