<commit_before>SHA := $(shell git rev-parse --short HEAD)

all: build

deps:
	# which npm && npm -g install uglify-js less autoprefixer
	go get github.com/GeertJohan/go.rice/rice
	go get github.com/franela/goblin
	go get -t -v ./...

test:
	go vet ./...
	go test -cover -short ./...

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

build:
	mkdir -p packaging/output
	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

install:
	install -t /usr/local/bin packaging/root/usr/local/bin/drone 
	install -t /usr/local/bin packaging/root/usr/local/bin/droned 

run:
	@go run server/main.go --config=$$HOME/.drone/config.toml

clean:
	find . -name "*.out" -delete
	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

packages: clean build embed deb rpm

# embeds content in go source code so that it is compiled
# and packaged inside the go binary file.
embed:
	rice --import-path="github.com/drone/drone/server" append --exec="packaging/root/usr/local/bin/droned"

# creates a debian package for drone to install
# `sudo dpkg -i drone.deb`
deb:
	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 \<commit_msg>Testing: Make MySQL DB creating more error resilient<commit_after>SHA := $(shell git rev-parse --short HEAD)

all: build

deps:
	# which npm && npm -g install uglify-js less autoprefixer
	go get github.com/GeertJohan/go.rice/rice
	go get github.com/franela/goblin
	go get -t -v ./...

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
	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

install:
	install -t /usr/local/bin packaging/root/usr/local/bin/drone
	install -t /usr/local/bin packaging/root/usr/local/bin/droned

run:
	@go run server/main.go --config=$$HOME/.drone/config.toml

clean:
	find . -name "*.out" -delete
	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

packages: clean build embed deb rpm

# embeds content in go source code so that it is compiled
# and packaged inside the go binary file.
embed:
	rice --import-path="github.com/drone/drone/server" append --exec="packaging/root/usr/local/bin/droned"

# creates a debian package for drone to install
# `sudo dpkg -i drone.deb`
deb:
	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 \
{'fraction_non_alphanumeric': 0.13652045342533267, 'fraction_numerical': 0.01232134056185313, 'mean_word_length': 3.4850828729281766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '268571', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1478, 'n_words': 384}