2021-02-19 08:43:03 +00:00
|
|
|
GO_VERSION=1.16
|
2019-09-14 12:11:40 +00:00
|
|
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
|
|
|
|
2019-10-06 20:07:31 +00:00
|
|
|
DOCKER_RUN?=
|
|
|
|
_with-docker:
|
|
|
|
$(eval DOCKER_RUN=docker run --rm -v $(shell pwd)/../../..:/go/src/ -v $(shell pwd)/build:/build -w / golang:$(GO_VERSION))
|
|
|
|
|
2019-09-14 12:11:40 +00:00
|
|
|
all: deps build
|
|
|
|
|
|
|
|
deps:
|
|
|
|
go get -u golang.org/x/net/context
|
|
|
|
go get -u golang.org/x/net/context/ctxhttp
|
|
|
|
go get -u github.com/golang/protobuf/proto
|
|
|
|
go get -u github.com/golang/protobuf/protoc-gen-go
|
2021-02-19 08:43:03 +00:00
|
|
|
go get -d docker.io/go-docker
|
2019-09-14 12:11:40 +00:00
|
|
|
|
|
|
|
formatcheck:
|
|
|
|
([ -z "$(shell gofmt -d $(GOFILES_NOVENDOR))" ]) || (echo "Source is unformatted"; exit 1)
|
|
|
|
|
|
|
|
format:
|
|
|
|
@gofmt -w ${GOFILES_NOVENDOR}
|
|
|
|
|
|
|
|
test-agent:
|
2019-10-08 10:09:31 +00:00
|
|
|
$(DOCKER_RUN) go test -race -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
|
2019-09-14 12:11:40 +00:00
|
|
|
|
|
|
|
test-server:
|
2019-10-08 10:09:31 +00:00
|
|
|
$(DOCKER_RUN) go test -race -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server
|
2019-09-14 12:11:40 +00:00
|
|
|
|
2019-11-12 13:27:39 +00:00
|
|
|
test-frontend:
|
|
|
|
(cd web/; yarn run test)
|
|
|
|
|
2019-09-14 12:11:40 +00:00
|
|
|
test-lib:
|
2019-10-08 10:09:31 +00:00
|
|
|
$(DOCKER_RUN) go test -race -timeout 30s $(shell go list ./... | grep -v '/cmd/')
|
2019-09-14 12:11:40 +00:00
|
|
|
|
|
|
|
test: test-lib test-agent test-server
|
|
|
|
|
|
|
|
build-agent:
|
2019-10-06 20:07:31 +00:00
|
|
|
$(DOCKER_RUN) go build -o build/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
2019-09-14 12:11:40 +00:00
|
|
|
|
|
|
|
build-server:
|
2019-10-06 20:07:31 +00:00
|
|
|
$(DOCKER_RUN) go build -o build/drone-server github.com/laszlocph/woodpecker/cmd/drone-server
|
2019-09-14 12:11:40 +00:00
|
|
|
|
2019-11-12 13:27:39 +00:00
|
|
|
build-frontend:
|
|
|
|
(cd web/; yarn run build)
|
|
|
|
|
|
|
|
|
2019-09-14 12:11:40 +00:00
|
|
|
build: build-agent build-server
|
|
|
|
|
|
|
|
install:
|
|
|
|
go install github.com/laszlocph/woodpecker/cmd/drone-agent
|
|
|
|
go install github.com/laszlocph/woodpecker/cmd/drone-server
|