Make CI script to verify that vendor is in sync
.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
