From b0be2709582f996e06905a2301c9558efa6f33ba Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Wed, 13 Mar 2019 08:58:11 +0100 Subject: [PATCH] Makefile.common: add deps target (#5339) Signed-off-by: Simon Pasquier --- .travis.yml | 7 ++++++- Makefile.common | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 41255ff1f..7e005a95b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,12 @@ go: go_import_path: github.com/prometheus/prometheus +# This ensures that the local cache is filled before running the CI. +# travis_retry retries the command 3 times if it fails as we've experienced +# random issues on Travis. +before_install: +- travis_retry make deps + script: -- GO111MODULE=on travis_retry go mod download - make check_license style unused test staticcheck check_assets - git diff --exit-code diff --git a/Makefile.common b/Makefile.common index 7105cff02..108e49409 100644 --- a/Makefile.common +++ b/Makefile.common @@ -116,6 +116,15 @@ common-check_license: exit 1; \ fi +.PHONY: common-deps +common-deps: + @echo ">> getting dependencies" +ifdef GO111MODULE + GO111MODULE=$(GO111MODULE) $(GO) mod download +else + $(GO) get $(GOOPTS) -t ./... +endif + .PHONY: common-test-short common-test-short: @echo ">> running short tests" @@ -221,7 +230,6 @@ precheck:: define PRECHECK_COMMAND_template = precheck:: $(1)_precheck - PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1))) .PHONY: $(1)_precheck $(1)_precheck: