Add verify make rule

This commit is contained in:
Christoph Blecker 2017-07-28 12:19:30 -07:00
parent 724d653337
commit b73865f44c
No known key found for this signature in database
GPG Key ID: B34A59A9D39F838B
2 changed files with 14 additions and 10 deletions

View File

@ -1,17 +1,21 @@
IMAGE_NAME=kube-communitydocs
all: \
build-image \
gen-docs \
default: \
generate \
reset-docs:
git checkout HEAD -- sig-list.md sig-*
git checkout HEAD -- sig-list.md sig-*/README.md
build-image:
docker build -t $(IMAGE_NAME) -f generator/Dockerfile generator
docker build -q -t $(IMAGE_NAME) -f generator/Dockerfile generator
gen-docs:
generate: build-image
docker run --rm -e WG -e SIG -v $(shell pwd):/go/src/app/generated $(IMAGE_NAME) app
verify:
@hack/verify.sh
test: build-image
docker run --rm $(IMAGE_NAME) go test -v ./...
.PHONY: default reset-docs build-image generate verify test

8
scripts/verify.sh → hack/verify.sh Normal file → Executable file
View File

@ -7,14 +7,14 @@ mkdir $TMPDIR
cp -r sig* Makefile generator $TMPDIR
cd $TMPDIR
make all
make 1>/dev/null
mismatches=0
break=$(printf "=%.0s" $(seq 1 68))
for file in $(ls $CRTDIR/sig-*/README.md $CRTDIR/sig-list.md); do
real=${file#$CRTDIR/}
if ! diff -q <(sed -e '/Last generated/d' $file) <(sed -e '/Last generated/d' $TMPDIR/$real) &>/dev/null; then
if ! diff -q $file $TMPDIR/$real &>/dev/null; then
echo "$file does not match $TMPDIR/$real";
mismatches=$((mismatches+1))
fi;
@ -28,8 +28,8 @@ if [ $mismatches -gt "0" ]; then
noun="mismatches were"
fi
echo "$mismatches $noun detected."
echo "Do not manually edit sig-list.md or anything inside the sig folders."
echo "Instead make your changes to sigs.yaml and run \`make all\`.";
echo "Do not manually edit sig-list.md or README.md files inside the sig folders."
echo "Instead make your changes to sigs.yaml and then run \`make\`.";
echo $break
exit 1;
fi