-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
110 lines (94 loc) · 2.06 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
#
# Cargo helpers.
#
LIBTORCH=~/torch/libtorch
.PHONY : run
ifneq ($(wildcard $(LIBTORCH)),)
LIBTORCH_PATH=$(shell realpath $(LIBTORCH))
LD_LIBRARY_PATH=$(LIBTORCH_PATH)/lib
run :
LIBTORCH=$(LIBTORCH) \
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
cargo run
else
run :
@echo "No LIBTORCH found, GPU won't be available"
cargo run
endif
.PHONY : build
build :
cargo build
.PHONY : format
format :
cargo fmt --
.PHONY : lint
lint :
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- \
-D warnings \
-A clippy::let_and_return \
-A clippy::redundant_clone
.PHONY : test
test :
@cargo test
.PHONY : doc
doc :
cargo doc
.PHONY : post
post :
curl \
-v \
-d '{"text":"Hello, World!"}' \
-H "Content-Type: application/json" \
http://localhost:3030/generate
.PHONY : post-many
post-many :
curl \
-s \
-S \
-d '{"text":"Hello, World!"}' \
-H "Content-Type: application/json" \
http://localhost:3030/generate > /dev/null &
curl \
-s \
-S \
-d '{"text":"Stay at home"}' \
-H "Content-Type: application/json" \
http://localhost:3030/generate > /dev/null &
curl \
-s \
-S \
-d '{"text":"Wash your hands"}' \
-H "Content-Type: application/json" \
http://localhost:3030/generate > /dev/null &
curl \
-s \
-S \
-d '{"text":"Do not touch your face"}' \
-H "Content-Type: application/json" \
http://localhost:3030/generate > /dev/null &
#
# Git helpers.
#
.PHONY: create-branch
create-branch :
ifneq ($(issue),)
git checkout -b ISSUE-$(issue)
git push --set-upstream origin $$(git branch | grep \* | cut -d ' ' -f2)
else ifneq ($(name),)
git checkout -b $(name)
git push --set-upstream origin $$(git branch | grep \* | cut -d ' ' -f2)
else
$(error must supply 'issue' or 'name' parameter)
endif
.PHONY : delete-branch
delete-branch :
@BRANCH=`git rev-parse --abbrev-ref HEAD` \
&& [ $$BRANCH != 'master' ] \
&& echo "On branch $$BRANCH" \
&& echo "Checking out master" \
&& git checkout master \
&& git pull \
&& echo "Deleting branch $$BRANCH" \
&& git branch -d $$BRANCH \
&& git remote prune origin