diff --git a/.ruby-version b/.ruby-version index 276cbf9e28..3f684d2d90 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.0 +2.3.4 diff --git a/Makefile b/Makefile index 07d62e64ac..d38d32e05f 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ CODECGEN_EXE=$(CODECGEN_DIR)/bin/codecgen_$(shell go env GOHOSTOS)_$(shell go en CODECGEN_UID=0 GET_CODECGEN_DEPS=$(shell find $(1) -maxdepth 1 -type f -name '*.go' -not -name '*_test.go' -not -name '*.codecgen.go' -not -name '*.generated.go') CODECGEN_TARGETS=report/report.codecgen.go render/detailed/detailed.codecgen.go +RUNNER_EXE=tools/runner/runner RM=--rm RUN_FLAGS=-ti BUILD_IN_CONTAINER=true @@ -86,7 +87,7 @@ prog/externalui/externalui.go: client/build-external/index.html ifeq ($(BUILD_IN_CONTAINER),true) -$(SCOPE_EXE) $(RUNSVINIT) lint tests shell prog/staticui/staticui.go prog/externalui/externalui.go: $(SCOPE_BACKEND_BUILD_UPTODATE) +$(SCOPE_EXE) $(RUNSVINIT) $(RUNNER_EXE) lint tests shell prog/staticui/staticui.go prog/externalui/externalui.go: $(SCOPE_BACKEND_BUILD_UPTODATE) @mkdir -p $(shell pwd)/.pkg $(SUDO) docker run $(RM) $(RUN_FLAGS) \ -v $(shell pwd):/go/src/github.com/weaveworks/scope \ @@ -98,7 +99,7 @@ $(SCOPE_EXE) $(RUNSVINIT) lint tests shell prog/staticui/staticui.go prog/extern else -$(SCOPE_EXE): $(SCOPE_BACKEND_BUILD_UPTODATE) +$(SCOPE_EXE) $(RUNNER_EXE): $(SCOPE_BACKEND_BUILD_UPTODATE) time $(GO) build $(GO_BUILD_FLAGS) -o $@ ./$(@D) @strings $@ | grep cgo_stub\\\.go >/dev/null || { \ rm $@; \ @@ -124,7 +125,7 @@ shell: $(SCOPE_BACKEND_BUILD_UPTODATE) /bin/bash tests: $(SCOPE_BACKEND_BUILD_UPTODATE) $(CODECGEN_TARGETS) - ./tools/test -no-go-get + ./tools/test -no-go-get -tags $(GO_BUILD_TAGS) lint: $(SCOPE_BACKEND_BUILD_UPTODATE) ./tools/lint diff --git a/circle.yml b/circle.yml index 0858da0f16..68f6ac32f9 100644 --- a/circle.yml +++ b/circle.yml @@ -23,31 +23,27 @@ dependencies: - "~/docker" override: - | - sudo apt-get update && sudo apt-get install jq pv && - sudo chmod a+wr --recursive /usr/local/go/pkg && sudo chown ubuntu:ubuntu "$HOME/.bashrc.backup" (curl https://sdk.cloud.google.com | bash) && (test -z "$SECRET_PASSWORD" || bin/setup-circleci-secrets "$SECRET_PASSWORD") && - make deps && + go get github.com/2opremio/trifles/wscat && mkdir -p $(dirname $SRCDIR) && cp -r $(pwd)/ $SRCDIR - "cd $SRCDIR/client; ../tools/rebuild-image weaveworks/scope-ui-build . Dockerfile package.json webpack.production.config.js .eslintrc .babelrc && touch $SRCDIR/.scope_ui_build.uptodate" - "cd $SRCDIR/backend; ../tools/rebuild-image weaveworks/scope-backend-build . Dockerfile build.sh && touch $SRCDIR/.scope_backend_build.uptodate" - test -z "$SECRET_PASSWORD" || (cd $SRCDIR/integration; ./gce.sh make_template): parallel: false - - sudo apt-get update && sudo apt-get install python-pip && sudo pip install awscli + - sudo pip install awscli + - cd $SRCDIR; make RM= CODECGEN_UID=23 all tools/runner/runner: + parallel: true test: override: - - cd $SRCDIR; make RM= lint: + - cd $SRCDIR; case $CIRCLE_NODE_INDEX in 0) make RM= lint ;; 1) make RM= RUN_FLAGS= client-test client-lint ;; esac: parallel: true - cd $SRCDIR; COVERDIR=./coverage make RM= CODECGEN_UID=23 tests: parallel: true - - cd $SRCDIR; make RM= client-test static: - parallel: true - - cd $SRCDIR; make RM= client-lint static: - parallel: true - cd $SRCDIR; rm -f prog/scope; if [ "$CIRCLE_NODE_INDEX" = "0" ]; then GOARCH=arm make GO_BUILD_INSTALL_DEPS= RM= prog/scope; else GOOS=darwin make GO_BUILD_INSTALL_DEPS= RM= prog/scope; fi: parallel: true - cd $SRCDIR; rm -f prog/scope; make RM=: @@ -62,9 +58,10 @@ test: post: - test -z "$SECRET_PASSWORD" || (cd $SRCDIR/integration; ./gce.sh destroy): parallel: true + background: true - test "$CIRCLE_NODE_INDEX" != "0" || (cd $SRCDIR; ./tools/cover/gather_coverage.sh ./coverage $SRCDIR/coverage): parallel: true - - test "$CIRCLE_NODE_INDEX" != "0" || (goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/profile.cov -service=circleci || true): + - test "$CIRCLE_NODE_INDEX" != "0" || (go get github.com/mattn/goveralls && goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/profile.cov -service=circleci || true): parallel: true - test "$CIRCLE_NODE_INDEX" != "0" || (cd $SRCDIR; cp scope.tar $CIRCLE_ARTIFACTS): parallel: true diff --git a/extras/Makefile b/extras/Makefile index aa045b2a24..6d3797f793 100644 --- a/extras/Makefile +++ b/extras/Makefile @@ -13,7 +13,7 @@ $(TARGETS): weaveworks/scope-backend-build -C extras $@ else $(TARGETS): - go build -ldflags "-extldflags \"-static\"" -tags netgo -o $@ ./$(@D) + go build -ldflags "-extldflags \"-static\"" -tags 'netgo unsafe' -o $@ ./$(@D) endif test: diff --git a/tools/test b/tools/test index 1497e7a2ae..e8bca6b632 100755 --- a/tools/test +++ b/tools/test @@ -33,9 +33,13 @@ while [ $# -gt 0 ]; do shift 1 ;; "-netgo") - TAGS="-tags netgo" + TAGS="netgo" shift 1 ;; + "-tags") + TAGS="$2" + shift 2 + ;; "-p") PARALLEL=true shift 1 @@ -51,7 +55,7 @@ while [ $# -gt 0 ]; do esac done -GO_TEST_ARGS=($TAGS -cpu 4 -timeout $TIMEOUT) +GO_TEST_ARGS=(-tags "${TAGS[@]}" -cpu 4 -timeout $TIMEOUT) if [ -n "$SLOW" ] || [ -n "$CIRCLECI" ]; then SLOW=true @@ -97,7 +101,7 @@ go test -i "${GO_TEST_ARGS[@]}" "${TESTDIRS[@]}" run_test() { local dir=$1 if [ -z "$NO_GO_GET" ]; then - go get -t "$TAGS" "$dir" + go get -t -tags "${TAGS[@]}" "$dir" fi local GO_TEST_ARGS_RUN=("${GO_TEST_ARGS[@]}")