forked from mat/besticon
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
116 lines (85 loc) · 4.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
build:
go get github.com/mat/besticon/...
test_all: build test test_bench
go test -v github.com/mat/besticon/besticon/iconserver
test:
go test -v github.com/mat/besticon/ico
go test -v github.com/mat/besticon/besticon
go test -v github.com/mat/besticon/besticon/iconserver
go test -v github.com/mat/besticon/lettericon
go test -v github.com/mat/besticon/colorfinder
test_race:
go test -v -race github.com/mat/besticon/ico
go test -v -race github.com/mat/besticon/besticon
go test -v -race github.com/mat/besticon/besticon/iconserver
go test -v -race github.com/mat/besticon/lettericon
go test -v -race github.com/mat/besticon/colorfinder
test_bench:
go test github.com/mat/besticon/lettericon -bench .
go test github.com/mat/besticon/colorfinder -bench .
deploy:
git push heroku master
heroku config:set DEPLOYED_AT=`date +%s`
install:
go get ./...
run_server:
go build -o bin/iconserver github.com/mat/besticon/besticon/iconserver
PORT=3000 DEPLOYED_AT=`date +%s` HOST_ONLY_DOMAINS=* POPULAR_SITES=bing.com,github.com,instagram.com,reddit.com ./bin/iconserver
coverage_besticon:
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/besticon && go tool cover -html=coverage.out && unlink coverage.out
coverage_ico:
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/ico && go tool cover -html=coverage.out && unlink coverage.out
coverage_iconserver:
go test -coverprofile=coverage.out -covermode=count github.com/mat/besticon/besticon/iconserver && go tool cover -html=coverage.out && unlink coverage.out
test_websites:
go get ./...
cat besticon/testdata/websites.txt | xargs -P 10 -n 1 besticon
minify_css:
curl -X POST -s --data-urlencode 'input@besticon/iconserver/assets/main.css' http://cssminifier.com/raw > besticon/iconserver/assets/main-min.css
gotags:
gotags -tag-relative=true -R=true -sort=true -f="tags" -fields=+l .
#
## Building ##
#
clean:
rm -rf bin/*
rm -f iconserver*.zip
build_darwin_amd64:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/darwin_amd64/iconserver -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
build_linux_amd64:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/linux_amd64/iconserver -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
build_windows_amd64:
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o bin/windows_amd64/iconserver.exe -ldflags "-X github.com/mat/besticon/besticon.BuildDate=`date +'%Y-%m-%d'`" github.com/mat/besticon/besticon/iconserver
build_all_platforms: build_darwin_amd64 build_linux_amd64 build_windows_amd64
find bin/ -type file | xargs file
## Docker ##
docker_build_image:
docker build -t matthiasluedtke/iconserver:latest -t matthiasluedtke/iconserver:`cat VERSION` .
docker_run:
docker run -p 3000:8080 --env-file docker_run.env matthiasluedtke/iconserver:latest
docker_push_images_all: docker_push_image_latest docker_push_image_version
docker_push_image_latest:
docker push matthiasluedtke/iconserver:latest
docker_push_image_version:
docker push matthiasluedtke/iconserver:`cat VERSION`
## New GitHub Release ##
github_package: clean build_all_platforms
zip -o -j iconserver_darwin-amd64 bin/darwin_amd64/* Readme.markdown LICENSE NOTICES
zip -o -j iconserver_linux_amd64 bin/linux_amd64/* Readme.markdown LICENSE NOTICES
zip -o -j iconserver_windows_amd64 bin/windows_amd64/* Readme.markdown LICENSE NOTICES
file iconserver*.zip
ls -alht iconserver*.zip
new_release: update_notices_file bump_version rewrite-version.go git_tag_version
bump_version:
vi VERSION
rewrite-version.go:
echo "package besticon\n\n// Version string, same as VERSION, generated my Make\nconst VersionString = \"`cat VERSION`\"" > besticon/version.go
git_tag_version:
git commit VERSION besticon/version.go -m "Release `cat VERSION`"
git tag `cat VERSION`
update_notices_file:
licensed cache
licensed notice
cp .licenses/NOTICE NOTICES
cat notices-more/* >> NOTICES
git commit NOTICES -m "Update NOTICES" || echo "No change to NOTICES to commit"