2014-03-02 03:46:10 +00:00
SHA := $( shell git rev-parse --short HEAD)
2014-02-07 10:10:01 +00:00
2014-06-21 21:22:38 +00:00
all : build
2014-04-10 17:44:26 +00:00
deps :
2014-07-14 02:53:59 +00:00
# which npm && npm -g install uglify-js less
2014-06-12 20:01:11 +00:00
go get github.com/GeertJohan/go.rice/rice
2014-08-04 04:33:47 +00:00
go get github.com/franela/goblin
2014-06-12 19:55:57 +00:00
go list github.com/drone/drone/... | xargs go get -t -v
2014-04-10 17:44:26 +00:00
2014-06-04 21:25:38 +00:00
test :
go vet ./...
go test -cover -short ./...
2014-04-10 17:44:26 +00:00
2014-10-01 06:30:42 +00:00
test_mysql :
mysql -P 3306 --protocol= tcp -u root -e 'create database test;'
TEST_DRIVER = "mysql" TEST_DATASOURCE = "root@tcp(127.0.0.1:3306)/test" go test -short github.com/drone/drone/server/datastore/database
test_postgres :
TEST_DRIVER = "postgres" TEST_DATASOURCE = "host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test -short github.com/drone/drone/server/datastore/database
2014-07-14 02:41:08 +00:00
build :
2014-09-25 04:24:12 +00:00
go build -o debian/drone/usr/local/bin/drone -ldflags " -X main.revision $( SHA) " github.com/drone/drone/cli
2014-07-14 02:41:08 +00:00
go build -o debian/drone/usr/local/bin/droned -ldflags " -X main.revision $( SHA) " github.com/drone/drone/server
2014-07-17 05:14:53 +00:00
install :
install -t /usr/local/bin debian/drone/usr/local/bin/drone
install -t /usr/local/bin debian/drone/usr/local/bin/droned
2014-06-21 21:22:38 +00:00
run :
2014-09-29 01:36:24 +00:00
@go run server/main.go --config= $$ HOME/.drone/config.toml
2014-06-21 21:22:38 +00:00
2014-06-04 21:25:38 +00:00
clean :
2014-07-14 02:41:08 +00:00
find . -name "*.out" -delete
rm -f debian/drone/usr/local/bin/drone
rm -f debian/drone/usr/local/bin/droned
rm -f debian/drone.deb
rm -f server/server
2014-09-25 04:24:12 +00:00
rm -f cli/cli
2014-07-14 02:41:08 +00:00
lessc :
lessc --clean-css server/app/styles/drone.less server/app/styles/drone.css
2014-03-02 05:43:20 +00:00
2014-07-14 02:41:08 +00:00
dpkg : build embed deb
2014-06-12 00:42:49 +00:00
2014-06-21 21:22:38 +00:00
# embeds content in go source code so that it is compiled
# and packaged inside the go binary file.
2014-07-14 02:41:08 +00:00
embed :
rice --import-path= "github.com/drone/drone/server" append --exec= "debian/drone/usr/local/bin/droned"
2014-02-07 10:10:01 +00:00
2014-06-21 21:22:38 +00:00
# creates a debian package for drone to install
# `sudo dpkg -i drone.deb`
deb :
2014-07-13 23:04:10 +00:00
mkdir -p debian/drone/usr/local/bin
mkdir -p debian/drone/var/lib/drone
2014-06-21 21:22:38 +00:00
dpkg-deb --build debian/drone
2014-07-11 22:29:31 +00:00
2014-07-14 02:41:08 +00:00
# deploys drone to a staging server. this requires the following
# environment variables are set:
#
# DRONE_STAGING_HOST -- the hostname or ip
# DRONE_STAGING_USER -- the username used to login
# DRONE_STAGING_KEY -- the identity file path (~/.ssh/id_rsa)
2014-07-11 22:29:31 +00:00
deploy :
scp -i $$ DRONE_STAGING_KEY debian/drone.deb $$ DRONE_STAGING_USER@$$ DRONE_STAGING_HOST:/tmp
ssh -i $$ DRONE_STAGING_KEY $$ DRONE_STAGING_USER@$$ DRONE_STAGING_HOST -- dpkg -i /tmp/drone.deb