-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
110 lines (87 loc) · 3.09 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
.PHONY: start-production
start-production: update-version-info validate-env
./scripts/prod.sh up --detach --build
.PHONY: build-production
build-production:
./scripts/prod.sh build
.PHONY: stop-production
stop-production:
./scripts/prod.sh down
.PHONY: redeploy-production
redeploy-production: \
build-production \
stop-production \
start-production
# Validate docker-compose env files
.PHONY: validate-env
validate-env:
./scripts/validate-env.sh
# Make sure the fake testing repo is initialised.
./local-repos/test/.git:
cd ./local-repos/test/ && git init && git add . && git commit -m "Initial commit."
# Update current bench version
.PHONY: update-version-info
update-version-info:
./scripts/version.sh
# Clean the fake testing repo
.PHONY: clean-local-test-repo
clean-local-test-repo:
cd ./local-repos/test/ && rm -rf .git/
.PHONY: start-development
start-development: ./local-repos/test/.git update-version-info validate-env
./scripts/dev.sh up --remove-orphans --build
.PHONY: stop-development
stop-development: ./local-repos/test/.git
./scripts/dev.sh down
.PHONY: update-graphql-schema
update-graphql-schema: ./local-repos/test/.git
./scripts/dev.sh exec frontend /app/scripts/update-graphql-schema.sh
.PHONY: rebuild-pipeline
rebuild-pipeline: ./local-repos/test/.git
./scripts/dev.sh up --detach --build pipeline
.PHONY: rebuild-frontend
rebuild-frontend: ./local-repos/test/.git
./scripts/dev.sh up --detach --build frontend
.PHONY: bench
bench:
@cd ./local-repos/test/ && make -s bench
.PHONY: start-prometheus-alertmanager
start-prometheus-alertmanager:
cd ./prometheus/ && \
docker-compose --env-file=../environments/production.env up --detach
.PHONY: stop-prometheus-alertmanager
stop-prometheus-alertmanager:
cd ./prometheus/ && \
docker-compose --env-file=../environments/production.env down
.PHONY: start-node-exporter
start-node-exporter:
./prometheus/scripts/start-node-exporter.sh
.PHONY: runtest
runtest: ./local-repos/test/.git
./scripts/dev.sh \
exec pipeline bash -c 'cd /mnt/project; opam exec -- dune runtest'
.PHONY: coverage
coverage: ./local-repos/test/.git
./scripts/dev.sh \
exec pipeline bash -c \
'cd /mnt/project; opam exec -- dune runtest --instrument-with bisect_ppx --force; \
opam exec -- bisect-ppx-report summary --per-file; opam exec -- bisect-ppx-report html' \
&& echo "To view coverage html open file://${PWD}/pipeline/_coverage/index.html in your browser"
.PHONY: local-make-bench
local-make-bench: ./local-repos/test/.git
cd local-repos/test/; git add .; git commit --amend -m "New commit: $$(date)"; cd ..
.PHONY: dev-db-delete-repo
dev-db-delete-repo:
ifndef REPO_ID
$(error REPO_ID is not defined)
endif
@echo "Deleting data for '$(REPO_ID)' from the dev DB"
@./scripts/dev.sh exec db psql -U docker -c "DELETE FROM benchmarks where repo_id='$(REPO_ID)'; DELETE FROM benchmark_metadata where repo_id='$(REPO_ID)';"
.PHONY: migration
migration:
./scripts/dev.sh \
exec pipeline omigrate create --verbose --dir=/app/db/migrations $(NAME)
.PHONY: test-frontend
test-frontend:
./scripts/dev.sh \
exec frontend bash -c 'yarn build && yarn test'