1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-18 08:26:45 +02:00
woodpecker/Makefile

94 lines
3.3 KiB
Makefile
Raw Normal View History

SHA := $(shell git rev-parse --short HEAD)
2014-02-07 13:10:01 +03:00
all: build
deps:
# which npm && npm -g install uglify-js less autoprefixer
2014-06-12 23:01:11 +03:00
go get github.com/GeertJohan/go.rice/rice
2014-08-04 07:33:47 +03:00
go get github.com/franela/goblin
go get -t -v ./...
2014-06-05 00:25:38 +03:00
test:
go vet ./...
go test -cover -short ./...
test_mysql:
mysql -P 3306 --protocol=tcp -u root -e 'create database if not exists test;'
TEST_DRIVER="mysql" TEST_DATASOURCE="root@tcp(127.0.0.1:3306)/test" go test -short github.com/drone/drone/server/datastore/database
mysql -P 3306 --protocol=tcp -u root -e 'drop database test;'
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
build:
mkdir -p packaging/output
2014-10-12 19:22:51 +03:00
mkdir -p packaging/root/usr/local/bin
go build -o packaging/root/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/cli
go build -o packaging/root/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
2014-07-17 08:14:53 +03:00
install:
install -t /usr/local/bin packaging/root/usr/local/bin/drone
install -t /usr/local/bin packaging/root/usr/local/bin/droned
2014-07-17 08:14:53 +03:00
run:
2014-09-29 04:36:24 +03:00
@go run server/main.go --config=$$HOME/.drone/config.toml
2014-06-05 00:25:38 +03:00
clean:
find . -name "*.out" -delete
2014-10-12 19:22:51 +03:00
rm -rf packaging/output
rm -f packaging/root/usr/local/bin/drone
rm -f packaging/root/usr/local/bin/droned
lessc:
lessc --clean-css server/app/styles/drone.less | autoprefixer > server/app/styles/drone.css
2014-10-12 19:22:51 +03:00
packages: clean build embed deb rpm
2014-06-12 03:42:49 +03:00
# embeds content in go source code so that it is compiled
# and packaged inside the go binary file.
embed:
2014-10-12 19:22:51 +03:00
rice --import-path="github.com/drone/drone/server" append --exec="packaging/root/usr/local/bin/droned"
2014-02-07 13:10:01 +03:00
# creates a debian package for drone to install
# `sudo dpkg -i drone.deb`
deb:
2014-10-12 19:22:51 +03:00
fpm -s dir -t deb -n drone -v 0.3 -p packaging/output/drone.deb \
--deb-priority optional --category admin \
--force \
--deb-compression bzip2 \
--after-install packaging/scripts/postinst.deb \
--before-remove packaging/scripts/prerm.deb \
--after-remove packaging/scripts/postrm.deb \
--url https://github.com/drone/drone \
--description "Drone continuous integration server" \
-m "Brad Rydzewski <brad@drone.io>" \
--license "Apache License 2.0" \
--vendor "drone.io" -a amd64 \
--config-files /etc/drone/drone.toml \
packaging/root/=/
rpm:
fpm -s dir -t rpm -n drone -v 0.3 -p packaging/output/drone.rpm \
--rpm-compression bzip2 --rpm-os linux \
--force \
--after-install packaging/scripts/postinst.rpm \
--before-remove packaging/scripts/prerm.rpm \
--after-remove packaging/scripts/postrm.rpm \
--url https://github.com/drone/drone \
--description "Drone continuous integration server" \
-m "Brad Rydzewski <brad@drone.io>" \
--license "Apache License 2.0" \
--vendor "drone.io" -a amd64 \
--config-files /etc/drone/drone.toml \
packaging/root/=/
2014-07-12 01:29:31 +03: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-12 01:29:31 +03:00
deploy:
2014-10-22 10:13:47 +03:00
scp -i $$DRONE_STAGING_KEY packaging/output/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