Skip to content

Commit

Permalink
Add verify make rule
Browse files Browse the repository at this point in the history
  • Loading branch information
cblecker committed Jul 28, 2017
1 parent 724d653 commit b73865f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 4 deletions scripts/verify.sh → hack/verify.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit b73865f

Please sign in to comment.