mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-20 07:26:34 +00:00
Create Makefile and targets to build project
This commit is contained in:
parent
bfd7d0c46b
commit
7fd68a706e
3 changed files with 50 additions and 11 deletions
13
BUILDING
13
BUILDING
|
@ -1,15 +1,6 @@
|
|||
1. Install go 1.9 or later
|
||||
2. Install dependencies
|
||||
|
||||
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
|
||||
|
||||
3. Install binaries to $GOPATH/bin
|
||||
|
||||
go install github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||
go install github.com/laszlocph/woodpecker/cmd/drone-server
|
||||
2. Execute `make deps` to download dependencies
|
||||
3. Execute `make install` to compile project and install binaries to `GOPATH`
|
||||
|
||||
---
|
||||
|
||||
|
|
46
Makefile
Normal file
46
Makefile
Normal file
|
@ -0,0 +1,46 @@
|
|||
export GO111MODULE=off
|
||||
|
||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
||||
|
||||
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
|
||||
|
||||
formatcheck:
|
||||
([ -z "$(shell gofmt -d $(GOFILES_NOVENDOR))" ]) || (echo "Source is unformatted"; exit 1)
|
||||
|
||||
format:
|
||||
@gofmt -w ${GOFILES_NOVENDOR}
|
||||
|
||||
test-agent:
|
||||
go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-agent $(go list ./... | grep -v /vendor/)
|
||||
|
||||
test-server:
|
||||
ifneq ($(shell uname), "Linux")
|
||||
$(error Target OS is not Linux drone-server build skipped)
|
||||
endif
|
||||
go test -timeout 30s github.com/laszlocph/woodpecker/cmd/drone-server
|
||||
|
||||
test-lib:
|
||||
go test -timeout 30s $(shell go list ./... | grep -v '/cmd/')
|
||||
|
||||
test: test-lib test-agent test-server
|
||||
|
||||
build-agent:
|
||||
go build -o build/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||
|
||||
build-server:
|
||||
ifneq ($(shell uname), "Linux")
|
||||
$(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
|
||||
|
||||
install:
|
||||
go install github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||
go install github.com/laszlocph/woodpecker/cmd/drone-server
|
2
build/.gitignore
vendored
Normal file
2
build/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
drone-agent
|
||||
drone-server
|
Loading…
Reference in a new issue