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:
committed by
Michal Jan Matczuk
parent
1e766b10c9
commit
2569c3dd8f
@@ -10,9 +10,7 @@ env:
|
||||
- SCYLLA_VERSION=latest
|
||||
|
||||
before_install:
|
||||
- docker pull scylladb/scylla:${SCYLLA_VERSION}
|
||||
- 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
|
||||
- make run-scylla
|
||||
|
||||
install:
|
||||
- make get-deps get-tools
|
||||
|
||||
39
Makefile
39
Makefile
@@ -1,12 +1,20 @@
|
||||
all: check test
|
||||
|
||||
ifndef GOBIN
|
||||
export GOBIN := $(GOPATH)/bin
|
||||
ifndef SCYLLA_VERSION
|
||||
SCYLLA_VERSION := latest
|
||||
endif
|
||||
|
||||
define dl_tgz
|
||||
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
|
||||
endef
|
||||
ifndef SCYLLA_CPU
|
||||
SCYLLA_CPU := 0
|
||||
endif
|
||||
|
||||
ifndef GOTEST_CPU
|
||||
GOTEST_CPU := 1
|
||||
endif
|
||||
|
||||
ifndef GOBIN
|
||||
GOBIN := $(GOPATH)/bin
|
||||
endif
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
@@ -16,7 +24,7 @@ fmt:
|
||||
check:
|
||||
@$(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
|
||||
test:
|
||||
@@ -27,11 +35,26 @@ test:
|
||||
|
||||
.PHONY: 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
|
||||
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
|
||||
get-tools:
|
||||
|
||||
Reference in New Issue
Block a user