using rice append and cleaner build process

This commit is contained in:
Brad Rydzewski 2014-07-13 19:41:08 -07:00
parent 7d48ecad14
commit 88d940e58a
4 changed files with 25 additions and 1530 deletions

View file

@ -5,7 +5,7 @@ env:
- GOROOT=/usr/local/go - GOROOT=/usr/local/go
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin - PATH=$PATH:$GOROOT/bin:$GOPATH/bin
script: script:
- sudo apt-get -y install libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null - sudo apt-get -y install zip libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null
- make deps - make deps
- make test - make test
- make dpkg - make dpkg

View file

@ -5,42 +5,37 @@ all: build
deps: deps:
# npm install -g uglify-js # npm install -g uglify-js
# npm install -g less # npm install -g less
# npm -g install karma
# npm -g install karma-jasmine
# npm -g install karma-chrome-launcher
# npm -g install karma-phantomjs-launcher
go get github.com/GeertJohan/go.rice/rice go get github.com/GeertJohan/go.rice/rice
go list github.com/drone/drone/... | xargs go get -t -v go list github.com/drone/drone/... | xargs go get -t -v
build:
mkdir -p debian/drone/usr/local/bin
go build -o debian/drone/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/client
go build -o debian/drone/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
test: test:
go vet ./... go vet ./...
go test -cover -short ./... go test -cover -short ./...
build:
go build -o debian/drone/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/client
go build -o debian/drone/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
run: run:
@cd server && go run main.go @go run server/main.go
clean: clean:
@find . -name "*.out" -delete # remove go coverage output find . -name "*.out" -delete
@find . -name "*.sqlite" -delete # remove sqlite databases rm -f debian/drone/usr/local/bin/drone
@find . -name '*.rice-box.go' -delete # remove go rice files & embedded content rm -f debian/drone/usr/local/bin/droned
#@find . -name '*.css' -delete rm -f debian/drone.deb
@rm -r debian/drone/usr/local/bin debian/drone.deb server/server client/client server/template/html rm -f server/server
rm -f client/client
dpkg: rice build deb lessc:
lessc --clean-css server/app/styles/drone.less server/app/styles/drone.css
dpkg: build embed deb
# embeds content in go source code so that it is compiled # embeds content in go source code so that it is compiled
# and packaged inside the go binary file. # and packaged inside the go binary file.
rice: embed:
cd server && rice embed rice --import-path="github.com/drone/drone/server" append --exec="debian/drone/usr/local/bin/droned"
lessc:
lessc server/app/styles/drone.less server/app/styles/drone.css
lessc --clean-css server/app/styles/drone.less server/app/styles/drone.min.css
# creates a debian package for drone to install # creates a debian package for drone to install
# `sudo dpkg -i drone.deb` # `sudo dpkg -i drone.deb`
@ -49,6 +44,12 @@ deb:
mkdir -p debian/drone/var/lib/drone mkdir -p debian/drone/var/lib/drone
dpkg-deb --build debian/drone dpkg-deb --build debian/drone
# 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)
deploy: deploy:
scp -i $$DRONE_STAGING_KEY debian/drone.deb $$DRONE_STAGING_USER@$$DRONE_STAGING_HOST:/tmp 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 ssh -i $$DRONE_STAGING_KEY $$DRONE_STAGING_USER@$$DRONE_STAGING_HOST -- dpkg -i /tmp/drone.deb

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long