Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI build speed-ups #2574

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.3.4
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 $@; \
Expand All @@ -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
Expand Down
17 changes: 7 additions & 10 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion extras/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 7 additions & 3 deletions tools/test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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[@]}")
Expand Down