forked from bitemyapp/bloodhound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
129 lines (99 loc) · 3.67 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
117
118
119
120
121
122
123
124
125
126
127
128
129
.PHONY : build build-validate ghci test test-rerun test-ghci ghcid ghcid-validate \
weeder hlint hlint-watch mod-build
.DEFAULT_GOAL = help
stack = STACK_YAML='stack.yaml' stack
ghc_perf_options = --ghc-options '+RTS -A128M -RTS'
build = build $(ghc_perf_options)
ghci = ghci $(ghc_perf_options)
test = test $(ghc_perf_options)
stack-8.0 = STACK_YAML="stack-8.0.yaml" stack
stack-8.2 = STACK_YAML="stack-8.2.yaml" stack
stack-8.4 = STACK_YAML="stack-8.4.yaml" stack
stack-8.6 = STACK_YAML="stack-8.6.yaml" stack
elasticsearch_directory = elasticsearch
# stack build --ghc-options '+RTS -A128M -RTS'
## run build
build:
$(stack) $(build)
## build with validation options (Wall, Werror)
build-validate:
$(stack) build --fast --ghc-options '-Wall -Werror +RTS -A128M -RTS'
## run ghci
ghci:
$(stack) $(ghci)
## run tests
test: echo-warn
$(stack) $(test)
## run tests with forced re-run via "-r"
test-rerun: echo-warn
$(stack) $(test) --test-arguments "-r"
## run ghci with test stanza
test-ghci:
$(stack) $(ghci) bloodhound:test:bloodhound-tests
## run ghcid
ghcid:
ghcid -c "$(stack) ghci bloodhound:lib --test --ghci-options='-fobject-code -fno-warn-unused-do-bind' --main-is bloodhound:test:bloodhound-tests"
## run ghcid with validate options (Werror, etc.)
ghcid-validate:
ghcid -c "$(stack) ghci bloodhound:lib --test --ghci-options='-Werror -fobject-code -fno-warn-unused-do-bind' --main-is bloodhound:test:bloodhound-tests"
## run weeder
weeder:
weeder . --build
## run hlint
hlint:
hlint .
## hlint watch with `sos`
hlint-watch:
sos src/ -c "hlint ." -p "src/(.*)\.hs"
# mod-build:
# stack build --ghc-options '+RTS -A128M -RTS'
echo-warn:
@echo "Make certain you have an elasticsearch instance on localhost:9200 !"
## Test with GHC 8.0 and ES 5.x
test-8.0:
STACK_YAML="stack-8.0.yaml" stack test --fast bloodhound:test:bloodhound-tests --test-arguments="--qc-max-success 500"
## Test with GHC 8.2 and ES 5.x
test-8.2:
STACK_YAML="stack.yaml" stack test --fast bloodhound:test:bloodhound-tests --test-arguments="--qc-max-success 500"
## Build with the GHC 8.0 Stack YAML
build-8.0:
$(stack-8.0) $(build)
## Build with the GHC 8.2 Stack YAML
build-8.2:
$(stack-8.2) $(build)
## Build with the GHC 8.4 Stack YAML
build-8.4:
$(stack-8.4) $(build)
## Build with the GHC 8.6 Stack YAML
build-8.6:
$(stack-8.6) $(build)
## Upload the package to Hackage
upload:
stack upload --no-signature .
# Create ES5 instance
## Run test environment
compose-ES5:
@LOCAL_USER_ID=${LOCAL_USER_ID} docker-compose -f docker-compose.yml --project-directory $(elasticsearch_directory) up
## Run test environment in detach mode
compose-ES5-detach-up:
@LOCAL_USER_ID=${LOCAL_USER_ID} docker-compose -f docker-compose.yml --project-directory $(elasticsearch_directory) up -d
## Close test environment if run on detach mode
compose-ES5-detach-down:
@LOCAL_USER_ID=${LOCAL_USER_ID} docker-compose -f docker-compose.yml --project-directory $(elasticsearch_directory) down
## build the docker compose images
compose-build:
@LOCAL_USER_ID=${LOCAL_USER_ID} docker-compose -f docker-compose.yml --project-directory $(elasticsearch_directory) build
## Spawn bash shell in ES5 test container
ES5-shell:
@LOCAL_USER_ID=${LOCAL_USER_ID} docker-compose -f docker-compose.yml --project-directory $(elasticsearch_directory) exec elasticsearch1 bash
help:
@echo "Please use \`make <target>' where <target> is one of\n\n"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "%-30s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)