From a08ab87fe96aebbee8f5b602cffcbba81edd8558 Mon Sep 17 00:00:00 2001 From: Odin Ugedal Date: Wed, 19 Jun 2019 21:56:44 +0200 Subject: [PATCH] Make CI script to verify that vendor is in sync Signed-off-by: Odin Ugedal --- Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 81db9d9cc..f9a17eb8f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: all shell dbuild man release \ localtest localunittest localintegration \ test unittest integration \ - cross localcross + cross localcross vendor verify-dependencies CONTAINER_ENGINE := docker GO := go @@ -112,13 +112,24 @@ clean: rm -rf $(RELEASE_DIR) rm -rf $(MAN_DIR) -validate: +validate: verify-dependencies script/validate-gofmt script/validate-c $(GO) vet $(allpackages) ci: validate test release +vendor: + export GO111MODULE=on \ + $(GO) mod tidy && \ + $(GO) mod vendor && \ + $(GO) mod verify + +verify-dependencies: vendor + @test -z "$$(git status --porcelain -- go.mod go.sum vendor/)" \ + || (echo -e "git status:\n $$(git status -- go.mod go.sum vendor/)\nerror: vendor/, go.mod and/or go.sum not up to date. Run \"make vendor\" to update"; exit 1) \ + && echo "all vendor files are up to date." + cross: runcimage $(CONTAINER_ENGINE) run ${CONTAINER_ENGINE_RUN_FLAGS} -e BUILDTAGS="$(BUILDTAGS)" --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_IMAGE) make localcross