mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
ci: adds git fetch before doing schema checks
This fixes the CI errors when doing `make check-source` steps 'schema-added-check' and 'schema-removed-check'. These errors prevented CI from performing these steps correctly: ``` fatal: ambiguous argument 'main': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' ``` I changed it so that CI does a `git fetch origin` at first and do the `git diff` against 'origin/master' (which then exist). Also fixed a bug in the script that was missing $$master in the same line. Also I added that the script shows the actual diff before failing, so the user quickly sees whats wrong.
This commit is contained in:
17
doc/Makefile
17
doc/Makefile
@@ -206,14 +206,19 @@ doc/index.rst: $(MANPAGES:=.md)
|
|||||||
)
|
)
|
||||||
|
|
||||||
# For CI to (very roughly!) check that we only deprecated fields, or labelled added ones
|
# 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
|
||||||
# So GitHub renamed master to main. This is painful.
|
|
||||||
schema-added-check:
|
schema-added-check:
|
||||||
@if ! git describe master >/dev/null 2>&1; then MASTER=main; else MASTER=master; fi; if git diff $$MASTER doc/schemas | grep -q '^+.*{' && ! git diff master doc/schemas | grep -q '^+.*"added"'; then echo 'New schema fields must have "added": "vNEXTVERSION"' >&2; exit 1; fi
|
@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 \
|
||||||
# So GitHub renamed master to main. This is painful.
|
git diff origin/master -- doc/schemas; \
|
||||||
|
echo 'New schema fields must have "added": "vNEXTVERSION"' >&2; exit 1; \
|
||||||
|
fi
|
||||||
schema-removed-check:
|
schema-removed-check:
|
||||||
@if ! git describe master >/dev/null 2>&1; then MASTER=main; else MASTER=master; fi; if git diff $$MASTER doc/schemas | grep -q '^-.*{' && ! git diff master doc/schemas | grep -q '^-.*"deprecated": "'; then echo 'Schema fields must be deprecated, with version, not removed' >&2; exit 1; fi
|
@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"'; then \
|
||||||
|
git diff origin/master -- 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
|
schema-diff-check: schema-added-check schema-removed-check
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user