chore(ci): parallelize js and go tests (#670)
This PR teases apart the golang and js build steps so that they can be run in parallel in circleci, or locally with make test -j2. Closes #599pull/10616/head
parent
f72ed76a47
commit
7e9f90dbce
|
@ -1,14 +1,20 @@
|
|||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
jstest:
|
||||
docker:
|
||||
# specify the version
|
||||
- image: circleci/golang:1.10.3-node-browsers
|
||||
|
||||
working_directory: /go/src/github.com/influxdata/platform
|
||||
steps:
|
||||
- checkout
|
||||
- run: make test
|
||||
- run: make test-js
|
||||
|
||||
gotest:
|
||||
docker:
|
||||
- image: circleci/golang:1.10.3
|
||||
working_directory: /go/src/github.com/influxdata/platform
|
||||
steps:
|
||||
- checkout
|
||||
- run: make test-go
|
||||
- run: make vet
|
||||
# TODO add these checks to the Makefile
|
||||
# - run: go get -v -t -d ./...
|
||||
|
@ -31,10 +37,12 @@ workflows:
|
|||
version: 2
|
||||
build-and-deploy:
|
||||
jobs:
|
||||
- build
|
||||
- gotest
|
||||
- jstest
|
||||
- deploy:
|
||||
requires:
|
||||
- build
|
||||
- gotest
|
||||
- jstest
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
node_modules
|
||||
vendor
|
||||
.netrc
|
||||
.vscode
|
||||
|
@ -14,9 +15,4 @@ idpdb.bolt
|
|||
/idpd
|
||||
/fluxd
|
||||
/transpilerd
|
||||
/bin
|
||||
|
||||
yarn.lock
|
||||
node_modules
|
||||
.godep
|
||||
.jsdep
|
||||
/bin
|
|
@ -642,12 +642,12 @@
|
|||
revision = "b4e1701a28efcc637d9afcca7d38e495fe909a09"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d65b917f934f8a870c0d4c251dbc524cef0cf8d6bdf7da8275213b75c1205019"
|
||||
digest = "1:d833c2b46766fc09d7d0e453ae928ae0b1288e59e12449285f943d02d6a95533"
|
||||
name = "github.com/kevinburke/go-bindata"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "fb8a22f0e4d56d895765b12de81fcc127b096a77"
|
||||
version = "v3.9.0"
|
||||
pruneopts = "NT"
|
||||
revision = "06af60a4461b70d84a2b173d92f9f425d78baf55"
|
||||
version = "v3.11.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5149009cc36718234a9ad2896b04b04716808b8d72143b5687c0a15b53132b27"
|
||||
|
|
10
Gopkg.toml
10
Gopkg.toml
|
@ -34,10 +34,15 @@ required = [
|
|||
"github.com/kevinburke/go-bindata"
|
||||
]
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/goreleaser/goreleaser"
|
||||
version = "0.81.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/kevinburke/go-bindata"
|
||||
version = "3.11.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/google/go-cmp"
|
||||
version = "0.2.0"
|
||||
|
@ -76,6 +81,11 @@ required = [
|
|||
go-tests = true
|
||||
unused-packages = true
|
||||
|
||||
[[prune.project]]
|
||||
name = "github.com/kevinburke/go-bindata"
|
||||
non-go = true
|
||||
unused-packages = false
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/andreyvit/diff"
|
||||
|
|
52
Makefile
52
Makefile
|
@ -12,7 +12,6 @@
|
|||
#
|
||||
|
||||
SUBDIRS := query task
|
||||
GOBINDATA := $(shell go list -f {{.Root}} github.com/kevinburke/go-bindata 2> /dev/null)
|
||||
UISOURCES := $(shell find chronograf/ui -type f -not \( -path chronograf/ui/build/\* -o -path chronograf/ui/node_modules/\* -prune \) )
|
||||
YARN := $(shell command -v yarn 2> /dev/null)
|
||||
|
||||
|
@ -44,13 +43,14 @@ UTILS := \
|
|||
bin/$(GOOS)/pigeon \
|
||||
bin/$(GOOS)/cmpgen \
|
||||
bin/$(GOOS)/protoc-gen-gogofaster \
|
||||
bin/$(GOOS)/goreleaser
|
||||
bin/$(GOOS)/goreleaser \
|
||||
bin/$(GOOS)/go-bindata
|
||||
|
||||
# Default target to build all commands.
|
||||
# Default target to build all go commands.
|
||||
#
|
||||
# This target setups the dependencies to correctly build all commands.
|
||||
# This target sets up the dependencies to correctly build all go commands.
|
||||
# Other targets must depend on this target to correctly builds CMDS.
|
||||
all: dep generate Gopkg.lock $(UTILS) subdirs $(CMDS)
|
||||
all: vendor node_modules $(UTILS) subdirs $(CMDS)
|
||||
|
||||
# Target to build subdirs.
|
||||
# Each subdirs must support the `all` target.
|
||||
|
@ -79,36 +79,28 @@ bin/$(GOOS)/protoc-gen-gogofaster: vendor $(call go_deps,./vendor/github.com/gog
|
|||
bin/$(GOOS)/goreleaser: ./vendor/github.com/goreleaser/goreleaser/main.go
|
||||
go build -i -o $@ ./vendor/github.com/goreleaser/goreleaser
|
||||
|
||||
dep: .jsdep .godep
|
||||
bin/$(GOOS)/go-bindata: ./vendor/github.com/kevinburke/go-bindata/go-bindata/main.go
|
||||
go build -i -o $@ ./vendor/github.com/kevinburke/go-bindata/go-bindata
|
||||
|
||||
.godep:
|
||||
ifndef GOBINDATA
|
||||
@echo "Installing go-bindata"
|
||||
go get -u github.com/kevinburke/go-bindata/...
|
||||
endif
|
||||
@touch .godep
|
||||
vendor: Gopkg.lock
|
||||
dep ensure -v -vendor-only
|
||||
|
||||
.jsdep: chronograf/ui/yarn.lock
|
||||
node_modules: chronograf/ui/node_modules
|
||||
|
||||
chronograf/ui/node_modules: chronograf/ui/yarn.lock
|
||||
ifndef YARN
|
||||
$(error Please install yarn 0.19.1+)
|
||||
else
|
||||
mkdir -p chronograf/ui/build && cd chronograf/ui && yarn --no-progress --no-emoji
|
||||
@touch .jsdep
|
||||
cd chronograf/ui && yarn --no-progress --no-emoji
|
||||
endif
|
||||
|
||||
#
|
||||
# Define how source dependencies are managed
|
||||
#
|
||||
|
||||
Gopkg.lock: Gopkg.toml
|
||||
dep ensure -v
|
||||
touch Gopkg.lock
|
||||
|
||||
vendor/github.com/mna/pigeon/main.go: Gopkg.lock
|
||||
dep ensure -v -vendor-only
|
||||
|
||||
vendor/github.com/goreleaser/goreleaser/main.go: Gopkg.lock
|
||||
dep ensure -v -vendor-only
|
||||
vendor/github.com/mna/pigeon/main.go: vendor
|
||||
vendor/github.com/goreleaser/goreleaser/main.go: vendor
|
||||
vendor/github.com/kevinburke/go-bindata/go-bindata/main.go: vendor
|
||||
|
||||
#
|
||||
# Define action only targets
|
||||
|
@ -117,22 +109,24 @@ vendor/github.com/goreleaser/goreleaser/main.go: Gopkg.lock
|
|||
fmt: $(SOURCES_NO_VENDOR)
|
||||
goimports -w $^
|
||||
|
||||
generate:
|
||||
# generate:
|
||||
# TODO: re-enable these after we decide on a strategy for building without running `go generate`.
|
||||
# $(GO_GENERATE) ./chronograf/dist/...
|
||||
# $(GO_GENERATE) ./chronograf/server/...
|
||||
# $(GO_GENERATE) ./chronograf/canned/...
|
||||
|
||||
jstest:
|
||||
test-js: node_modules
|
||||
cd chronograf/ui && yarn test --runInBand
|
||||
|
||||
test: all jstest
|
||||
test-go: vendor
|
||||
$(GO_TEST) ./...
|
||||
|
||||
test: test-go test-js
|
||||
|
||||
test-race: all
|
||||
$(GO_TEST) -race ./...
|
||||
|
||||
vet: all
|
||||
vet:
|
||||
$(GO_VET) -v ./...
|
||||
|
||||
bench: all
|
||||
|
@ -148,4 +142,4 @@ clean: $(SUBDIRS)
|
|||
rm -rf bin
|
||||
|
||||
# .PHONY targets represent actions that do not create an actual file.
|
||||
.PHONY: all subdirs $(SUBDIRS) fmt test test-race bench clean
|
||||
.PHONY: all subdirs $(SUBDIRS) fmt test test-go test-js test-race bench clean node_modules vet
|
||||
|
|
Loading…
Reference in New Issue