mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-03 14:18:42 +00:00
Introduce docker builds in Makefile
This commit is contained in:
parent
67a41ff92f
commit
b7a6e6bd37
1 changed files with 10 additions and 12 deletions
22
Makefile
22
Makefile
|
@ -1,7 +1,11 @@
|
||||||
|
GO_VERSION=1.12.4
|
||||||
export GO111MODULE=off
|
export GO111MODULE=off
|
||||||
|
|
||||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
||||||
|
|
||||||
|
DOCKER_RUN?=
|
||||||
|
_with-docker:
|
||||||
|
$(eval DOCKER_RUN=docker run --rm -v $(shell pwd)/../../..:/go/src/ -v $(shell pwd)/build:/build -w / golang:$(GO_VERSION))
|
||||||
|
|
||||||
all: deps build
|
all: deps build
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
|
@ -17,27 +21,21 @@ format:
|
||||||
@gofmt -w ${GOFILES_NOVENDOR}
|
@gofmt -w ${GOFILES_NOVENDOR}
|
||||||
|
|
||||||
test-agent:
|
test-agent:
|
||||||
go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
|
$(DOCKER_RUN) go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
test-server:
|
test-server:
|
||||||
ifneq ($(shell uname), "Linux")
|
$(DOCKER_RUN) go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server
|
||||||
$(error Target OS is not Linux drone-server build skipped)
|
|
||||||
endif
|
|
||||||
go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server
|
|
||||||
|
|
||||||
test-lib:
|
test-lib:
|
||||||
go test -timeout 30s $(shell go list ./... | grep -v '/cmd/')
|
$(DOCKER_RUN) go test -timeout 30s $(shell go list ./... | grep -v '/cmd/')
|
||||||
|
|
||||||
test: test-lib test-agent test-server
|
test: test-lib test-agent test-server
|
||||||
|
|
||||||
build-agent:
|
build-agent:
|
||||||
go build -o build/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
$(DOCKER_RUN) go build -o build/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||||
|
|
||||||
build-server:
|
build-server:
|
||||||
ifneq ($(shell uname), "Linux")
|
$(DOCKER_RUN) go build -o build/drone-server github.com/laszlocph/woodpecker/cmd/drone-server
|
||||||
$(error Target OS is not Linux drone-server build skipped)
|
|
||||||
endif
|
|
||||||
go build -o build/drone-server github.com/laszlocph/woodpecker/cmd/drone-server
|
|
||||||
|
|
||||||
build: build-agent build-server
|
build: build-agent build-server
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue