makefile: moved running Scylla to makefile target

- Modernised Makefile
- Scylla and go bench run on separate CPUs

Signed-off-by: Michał Matczuk <michal@scylladb.com>
This commit is contained in:
Michał Matczuk
2020-04-17 11:36:05 +02:00
committed by Michal Jan Matczuk
parent 1e766b10c9
commit 2569c3dd8f
2 changed files with 32 additions and 11 deletions

View File

@@ -10,9 +10,7 @@ env:
- SCYLLA_VERSION=latest - SCYLLA_VERSION=latest
before_install: before_install:
- docker pull scylladb/scylla:${SCYLLA_VERSION} - make run-scylla
- docker run --rm --name scylla -p 9042:9042 --cpus=0 -d scylladb/scylla:${SCYLLA_VERSION}
- until docker exec scylla cqlsh -e "DESCRIBE SCHEMA"; do sleep 2; done
install: install:
- make get-deps get-tools - make get-deps get-tools

View File

@@ -1,12 +1,20 @@
all: check test all: check test
ifndef GOBIN ifndef SCYLLA_VERSION
export GOBIN := $(GOPATH)/bin SCYLLA_VERSION := latest
endif endif
define dl_tgz ifndef SCYLLA_CPU
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)' SCYLLA_CPU := 0
endef endif
ifndef GOTEST_CPU
GOTEST_CPU := 1
endif
ifndef GOBIN
GOBIN := $(GOPATH)/bin
endif
.PHONY: fmt .PHONY: fmt
fmt: fmt:
@@ -16,7 +24,7 @@ fmt:
check: check:
@$(GOBIN)/golangci-lint run ./... @$(GOBIN)/golangci-lint run ./...
GOTEST := go test -count=1 -cover -race -tags all GOTEST := go test -cpu $(GOTEST_CPU) -count=1 -cover -race -tags all
.PHONY: test .PHONY: test
test: test:
@@ -27,11 +35,26 @@ test:
.PHONY: bench .PHONY: bench
bench: bench:
@go test -tags all -run=XXX -bench=. -benchmem ./... @go test -cpu $(GOTEST_CPU) -tags all -run=XXX -bench=. -benchmem ./...
.PHONY: run-scylla
run-scylla:
@echo "==> Running test instance of Scylla $(SCYLLA_VERSION)"
@docker pull scylladb/scylla:$(SCYLLA_VERSION)
@docker run --name scylla -p 9042:9042 --cpuset-cpus=$(SCYLLA_CPU) --memory 1G --rm -d scylladb/scylla:$(SCYLLA_VERSION)
@until docker exec scylla cqlsh -e "DESCRIBE SCHEMA"; do sleep 2; done
.PHONY: stop-scylla
stop-scylla:
@docker stop scylla
.PHONY: get-deps .PHONY: get-deps
get-deps: get-deps:
go get -t ./... @go mod download
define dl_tgz
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
endef
.PHONY: get-tools .PHONY: get-tools
get-tools: get-tools: