-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
97 lines (76 loc) · 3.08 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
DOCKER_COMPOSE_DEV = docker compose --file docker-compose.yaml --file docker-compose.dev.yaml
APP_CONSOLE = $(DOCKER_COMPOSE_DEV) exec app bin/console
.PHONY: dev
dev: bring-up-app-and-queue-watcher
$(DOCKER_COMPOSE_DEV) logs --follow
.PHONY: prod
prod: config.php
docker compose --file docker-compose.yaml --file docker-compose.prod.yaml build
docker compose --file docker-compose.yaml --file docker-compose.prod.yaml up --wait
docker compose --file docker-compose.yaml --file docker-compose.prod.yaml logs --follow
.PHONY: bring-up-app-and-queue-watcher
bring-up-app-and-queue-watcher: config.php build
$(DOCKER_COMPOSE_DEV) up --wait
.PHONY: bring-up-app-without-queue-watcher
bring-up-app-without-queue-watcher: config.php build
$(DOCKER_COMPOSE_DEV) up app --wait
$(DOCKER_COMPOSE_DEV) down queue-watcher
.PHONY: build
build:
$(DOCKER_COMPOSE_DEV) build
.PHONY: check
check: static-analysis fast-test
.PHONY: static-analysis
static-analysis: vendor
vendor/bin/phpcs --standard=phpcs.xml.dist --warning-severity=0 -p src/ tests/ web/
vendor/bin/composer-dependency-analyser
vendor/bin/phpstan analyse
.PHONY: test
test: config.php bring-up-app-and-queue-watcher
$(DOCKER_COMPOSE_DEV) exec app vendor/bin/phpunit $(TEST)
.PHONY: fast-test
fast-test: vendor
vendor/bin/phpunit --exclude-group web --exclude-group slow $(TEST)
.PHONY: clean
clean:
$(DOCKER_COMPOSE_DEV) down --volumes
rm -rf var/logs/*.json
.PHONY: all-checks
all-checks: config.php clean bring-up-app-without-queue-watcher
$(DOCKER_COMPOSE_DEV) exec app bash project_tests.sh
.PHONY: stop
stop:
$(DOCKER_COMPOSE_DEV) down
ENTITY = all
.PHONY: import-entity
import-entity: config.php bring-up-app-and-queue-watcher
$(APP_CONSOLE) queue:import $(ENTITY)
NEW_INDEX_NAME = elife_search_$(shell date "+%Y%m%d%H%M%S")
.PHONY: create-new-index
create-new-index:
$(APP_CONSOLE) search:setup --index=$(NEW_INDEX_NAME)
$(APP_CONSOLE) index:switch:write $(NEW_INDEX_NAME)
$(APP_CONSOLE) index:list
$(APP_CONSOLE) queue:import all
.PHONY: observe-indexing-status
observe-indexing-status:
$(APP_CONSOLE) queue:count
$(APP_CONSOLE) index:total:write
$(APP_CONSOLE) index:total:read
.PHONY: test-reindexing
test-reindexing: bring-up-app-and-queue-watcher
$(DOCKER_COMPOSE_DEV) exec app bin/reindex $(NEW_INDEX_NAME)
.PHONY: import-all-entities-in-journal-test-environment
import-all-entities-in-journal-test-environment:
kubectl -n journal--test create job --from=cronjob/search-queue-import-all import-all-$(shell date "+%Y%m%d-%H%M")
.PHONY: update-api-sdk
update-api-sdk: config.php build
$(DOCKER_COMPOSE_DEV) run --no-deps setup composer install
$(DOCKER_COMPOSE_DEV) run --no-deps setup composer update 'elife/api' 'elife/api-sdk' --no-suggest --no-interaction
.PHONY: clean-index-for-search-test
clean-index-for-search-test:
kubectl -n journal--test exec -it $$(kubectl get pods -n journal--test -o json | jq -r '.items[] | select(.metadata.name | startswith("search-queue-watcher-")) | .metadata.name' | head -n1) -- ./bin/console search:setup -d
config.php:
cp config.php.dist config.php
vendor: composer.json composer.lock
composer install