2018-05-08 23:02:01 +01:00
|
|
|
.PHONY: test lint proto check-copyrights build-dev-deps
|
2018-04-25 15:55:26 +01:00
|
|
|
|
2018-06-21 20:36:39 +01:00
|
|
|
TAG := $$(git rev-parse --short HEAD)
|
|
|
|
GO_VERSION := 1.10
|
|
|
|
|
2018-04-23 17:05:52 +01:00
|
|
|
lint: check-copyrights
|
|
|
|
@echo "Running ${@}"
|
2018-04-25 15:55:26 +01:00
|
|
|
@gometalinter \
|
2018-06-05 22:06:37 +01:00
|
|
|
--deadline=170s \
|
2018-04-06 17:32:34 +01:00
|
|
|
--disable-all \
|
2018-06-21 20:36:39 +01:00
|
|
|
--vendor .\
|
2018-04-06 17:32:34 +01:00
|
|
|
--enable=golint \
|
|
|
|
--enable=goimports \
|
|
|
|
--enable=vet \
|
|
|
|
--enable=deadcode \
|
2018-04-25 15:55:26 +01:00
|
|
|
--enable=goconst \
|
2018-04-06 17:32:34 +01:00
|
|
|
--exclude=.*\.pb\.go \
|
2018-04-25 15:55:26 +01:00
|
|
|
--exclude=.*_test.go \
|
2018-06-21 20:36:39 +01:00
|
|
|
--exclude=./vendor/* \
|
2018-04-06 17:32:34 +01:00
|
|
|
./...
|
2018-04-12 14:50:22 +01:00
|
|
|
|
2018-04-23 17:05:52 +01:00
|
|
|
check-copyrights:
|
|
|
|
@echo "Running ${@}"
|
|
|
|
@./scripts/check-for-header.sh
|
|
|
|
|
2018-06-13 19:22:32 +01:00
|
|
|
# Applies goimports to every go file (excluding vendored files)
|
|
|
|
goimports-fix:
|
|
|
|
goimports -w $$(find . -type f -name '*.go' -not -path "*/vendor/*")
|
|
|
|
|
2018-04-12 14:50:22 +01:00
|
|
|
proto:
|
|
|
|
@echo "Running ${@}"
|
2018-04-17 18:29:15 +01:00
|
|
|
./scripts/build-protos.sh
|
|
|
|
|
|
|
|
build-dev-deps:
|
2018-05-09 14:21:53 +01:00
|
|
|
go get github.com/golang/protobuf/protoc-gen-go
|
|
|
|
go get github.com/alecthomas/gometalinter
|
2018-04-25 15:55:26 +01:00
|
|
|
gometalinter --install --force
|
|
|
|
|
2018-05-08 23:02:01 +01:00
|
|
|
test: lint
|
|
|
|
go install -v ./...
|
|
|
|
go test ./...
|
2018-05-09 00:01:46 +01:00
|
|
|
@echo done
|
2018-06-05 22:06:37 +01:00
|
|
|
|
|
|
|
build-binaries:
|
|
|
|
docker build -t overlay .
|
|
|
|
|
|
|
|
run-overlay:
|
|
|
|
docker network create test-net
|
|
|
|
|
|
|
|
docker run -d \
|
|
|
|
--name redis \
|
|
|
|
--network test-net \
|
|
|
|
-p 127.0.0.1:6379:6379 \
|
|
|
|
redis
|
|
|
|
|
|
|
|
docker run -d \
|
|
|
|
--name=overlay \
|
|
|
|
--network test-net \
|
2018-06-22 14:33:57 +01:00
|
|
|
-p 127.0.0.1:8080:8080 \
|
2018-06-05 22:06:37 +01:00
|
|
|
-e REDIS_ADDRESS=redis:6379 \
|
|
|
|
-e REDIS_PASSWORD="" \
|
|
|
|
-e REDIS_DB=1 \
|
2018-06-22 14:33:57 +01:00
|
|
|
-e OVERLAY_PORT=7070 \
|
2018-06-05 22:06:37 +01:00
|
|
|
overlay
|
|
|
|
|
|
|
|
clean-local:
|
|
|
|
# cleanup overlay
|
|
|
|
docker stop overlay || true
|
|
|
|
docker rm overlay || true
|
|
|
|
# cleanup redis
|
|
|
|
docker stop redis || true
|
|
|
|
docker rm redis || true
|
|
|
|
# cleanup docker network
|
2018-06-21 20:36:39 +01:00
|
|
|
docker network rm test-net || true
|
|
|
|
|
|
|
|
images:
|
2018-06-22 21:17:37 +01:00
|
|
|
docker build --build-arg VERSION=${GO_VERSION} -t storjlabs/overlay:${TAG}-${GO_VERSION} -f cmd/overlay/Dockerfile .
|
2018-06-22 01:08:32 +01:00
|
|
|
docker tag storjlabs/overlay:${TAG}-${GO_VERSION} overlay:latest
|
2018-06-21 20:36:39 +01:00
|
|
|
|
|
|
|
push-images:
|
|
|
|
docker push storjlabs/overlay:${TAG}-${GO_VERSION}
|
2018-06-22 21:17:37 +01:00
|
|
|
docker push storjlabs/overlay:latest
|
|
|
|
|
|
|
|
install-deps:
|
|
|
|
go get -u -v golang.org/x/vgo
|
|
|
|
cd vgo install ./...
|