-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (51 loc) · 1.47 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
include Makefile_env.mk
mkfile_path := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
export KHAIII_BIN_PATH ?= $(mkfile_path)/integrations/tokenizers/dist/khaiii
export KOMORAN_JAR_PATH ?= $(mkfile_path)/integrations/tokenizers/dist/komoran
export TOKENIZER ?= khaiii
export DICTIONARY ?= krdict
BIN ?= dist/text2anki
run: build
mkdir -p tmp
$(BIN)
open:
(make run & (cd ui; sleep 1; npm run open)) | tee tmp/text2anki.log
setup:
cd integrations/tokenizers; make build
build:
go build -tags "$(TAGS)" -v -o $(BIN) .
TEST ?= ./...
test: test.diff db.testdb
go test -tags "$(TAGS)" $(TEST)
test.nocache: db.testdb
go test -count=1 -tags "$(TAGS)" $(TEST)
test.diff: db.diff
test.fixtures: db.testdb
# generate top level fixtures first
UPDATE_FIXTURES=true go test $(TEST) -run TestGen___ | $(FIXTURE_CLEAN_OUTPUT) || true
@echo; echo
UPDATE_FIXTURES=true make test | $(FIXTURE_CLEAN_OUTPUT)
test.slow: db.testdb
go test -v -count=1 -json -tags "$(TAGS)" $(TEST) \
| jq -r 'select(.Action == "pass" and .Test != null) | (.Package | split("/") | last ) + "," + .Test + "," + (.Elapsed | tostring)' \
| sort -k3 -n -t, \
| tail -n 25
lint:
golangci-lint run $(TEST)
lint.fix:
golangci-lint run --fix $(TEST)
ci.build: build
ci.diff: test.diff
ci.test: db.testdb
go test -v -tags "$(TAGS)" $(TEST)
ci.setup:
mkdir -p $(CI_BIN)
cd db; make ci.setup
db.seed:
cd db; make seed
db.generate:
cd db; make generate
db.diff:
cd db; make diff
db.testdb:
cd db; make testdb