2016-08-06 16:02:19 +00:00
.PHONY : build
2015-05-15 21:55:26 +00:00
2015-09-30 01:21:17 +00:00
PACKAGES = $( shell go list ./... | grep -v /vendor/)
2014-02-07 10:10:01 +00:00
2016-05-12 15:41:58 +00:00
i f n e q ( $( shell uname ) , D a r w i n )
2016-05-13 03:30:02 +00:00
EXTLDFLAGS = -extldflags "-static" $( null)
2016-05-12 15:41:58 +00:00
e l s e
EXTLDFLAGS =
e n d i f
2016-05-26 18:08:48 +00:00
all : gen build_static
2015-09-30 01:21:17 +00:00
2016-07-08 22:40:29 +00:00
deps : deps_backend deps_frontend
deps_frontend :
go get -u github.com/drone/drone-ui/dist
deps_backend :
2015-10-06 21:50:41 +00:00
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/jteeuwen/go-bindata/...
go get -u github.com/elazarl/go-bindata-assetfs/...
2016-09-28 19:56:19 +00:00
go get -u github.com/drone/mq/...
2016-09-29 21:48:17 +00:00
go get -u github.com/tidwall/redlog
2015-10-06 17:19:43 +00:00
2016-07-08 22:40:29 +00:00
gen : gen_template gen_migrations
2015-10-06 17:19:43 +00:00
gen_template :
2016-07-08 22:40:29 +00:00
go generate github.com/drone/drone/server/template
2015-10-06 17:19:43 +00:00
gen_migrations :
2016-03-25 19:54:16 +00:00
go generate github.com/drone/drone/store/datastore/ddl
2015-09-02 23:52:59 +00:00
2015-09-30 01:21:17 +00:00
test :
go test -cover $( PACKAGES)
2015-10-20 07:08:09 +00:00
# docker run --publish=3306:3306 -e MYSQL_DATABASE=test -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.6.27
test_mysql :
2015-11-11 22:52:29 +00:00
DATABASE_DRIVER = "mysql" DATABASE_CONFIG = "root@tcp(127.0.0.1:3306)/test?parseTime=true" go test github.com/drone/drone/store/datastore
2015-10-20 07:08:09 +00:00
# docker run --publish=5432:5432 postgres:9.4.5
test_postgres :
2015-11-11 22:52:29 +00:00
DATABASE_DRIVER = "postgres" DATABASE_CONFIG = "host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test github.com/drone/drone/store/datastore
2015-10-20 07:08:09 +00:00
2016-05-26 18:08:48 +00:00
# build the release files
2016-05-26 18:17:24 +00:00
build : build_static build_cross build_tar build_sha
2016-05-26 18:08:48 +00:00
build_static :
2016-09-01 16:45:08 +00:00
go install -ldflags '${EXTLDFLAGS}-X github.com/drone/drone/version.VersionDev=$(DRONE_BUILD_NUMBER)' github.com/drone/drone/drone
2016-09-03 18:58:20 +00:00
mkdir -p release
cp $( GOPATH) /bin/drone release/
2016-05-26 18:08:48 +00:00
# TODO this is getting moved to a shell script, do not alter
build_cross :
GOOS = linux GOARCH = amd64 CGO_ENABLED = 0 go build -o release/linux/amd64/drone github.com/drone/drone/drone
GOOS = linux GOARCH = arm64 CGO_ENABLED = 0 go build -o release/linux/arm64/drone github.com/drone/drone/drone
GOOS = linux GOARCH = arm CGO_ENABLED = 0 go build -o release/linux/arm/drone github.com/drone/drone/drone
GOOS = windows GOARCH = amd64 CGO_ENABLED = 0 go build -o release/windows/amd64/drone github.com/drone/drone/drone
GOOS = darwin GOARCH = amd64 CGO_ENABLED = 0 go build -o release/darwin/amd64/drone github.com/drone/drone/drone
# TODO this is getting moved to a shell script, do not alter
build_tar :
2016-06-27 20:18:36 +00:00
tar -cvzf release/linux/amd64/drone.tar.gz -C release/linux/amd64 drone
tar -cvzf release/linux/arm64/drone.tar.gz -C release/linux/arm64 drone
tar -cvzf release/linux/arm/drone.tar.gz -C release/linux/arm drone
tar -cvzf release/windows/amd64/drone.tar.gz -C release/windows/amd64 drone
tar -cvzf release/darwin/amd64/drone.tar.gz -C release/darwin/amd64 drone
2016-05-26 18:17:24 +00:00
# TODO this is getting moved to a shell script, do not alter
build_sha :
sha256sum release/linux/amd64/drone.tar.gz > release/linux/amd64/drone.sha256
sha256sum release/linux/arm64/drone.tar.gz > release/linux/arm64/drone.sha256
sha256sum release/linux/arm/drone.tar.gz > release/linux/arm/drone.sha256
sha256sum release/windows/amd64/drone.tar.gz > release/windows/amd64/drone.sha256
sha256sum release/darwin/amd64/drone.tar.gz > release/darwin/amd64/drone.sha256