-
Notifications
You must be signed in to change notification settings - Fork 371
/
Makefile
167 lines (131 loc) · 3.6 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# ------------------ BACKEND ------------------
# Build & Run
.PHONY: dev
dev:
make -j 2 watch up
.PHONY: watch
watch:
@docker compose watch --no-up
.PHONY: up
up:
@docker compose up --build
.PHONY: down
down:
@docker compose down
.PHONY: attach
attach:
@docker attach cohere-toolkit-backend-1
.PHONY: logs
logs:
@@docker compose logs --follow --tail 100 $(service)
.PHONY: exec-backend
exec-backend:
docker exec -ti cohere-toolkit-backend-1 bash
.PHONY: exec-db
exec-db:
docker exec -ti cohere-toolkit-db-1 bash
.PHONY: exec-terrarium
exec-terrarium:
docker exec -ti -u root cohere-toolkit-terrarium-1 /bin/sh
# Testing & Linting
.PHONY: run-unit-tests
run-unit-tests:
poetry run pytest src/backend/tests/unit/$(file) --cov=src/backend --cov-report=xml
.PHONY: run-community-tests
run-community-tests:
poetry run pytest src/community/tests/$(file) --cov=src/community --cov-report=xml
.PHONY: run-integration-tests
run-integration-tests:
docker compose run --rm --build backend poetry run pytest -c src/backend/pytest_integration.ini src/backend/tests/integration/$(file)
.PHONY: test-db
test-db:
docker compose stop test_db
docker compose rm -f test_db
docker compose up test_db -d
.PHONY: typecheck
typecheck:
poetry run pyright
.PHONY: lint
lint:
poetry run ruff check
.PHONY: lint-fix
lint-fix:
poetry run ruff check --fix
# Database management
.PHONY: migration
migration:
docker compose run --build backend alembic -c src/backend/alembic.ini revision --autogenerate -m "$(message)"
.PHONY: migrate
migrate:
docker compose run --build backend alembic -c src/backend/alembic.ini upgrade head
.PHONY: downgrade
downgrade:
docker compose run --build backend alembic -c src/backend/alembic.ini downgrade -1
.PHONY: reset-db
reset-db:
docker compose down
docker volume rm cohere_toolkit_db
# Setup
.PHONY: install
install:
poetry install --verbose --with dev
.PHONY: setup
setup:
poetry install --with setup,dev --verbose
poetry run python3 src/backend/scripts/cli/main.py
.PHONY: setup-use-community
setup-use-community:
poetry install --with setup,community --verbose
poetry run python3 src/backend/scripts/cli/main.py --use-community
.PHONY: win-setup
win-setup:
poetry install --with setup --verbose
poetry run python src/backend/scripts/cli/main.py
.PHONY: check-config
check-config:
poetry install --with setup --verbose
poetry run python src/backend/scripts/config/check_config.py
.PHONY: first-run
first-run:
make setup
make migrate
make dev
.PHONY: win-first-run
win-first-run:
make win-setup
make migrate
make dev
# ------------------ FRONTEND ------------------
# Assistants Web
.PHONY: format-web
format-web:
cd src/interfaces/assistants_web && npm run format:write
.PHONY: generate-client-web
generate-client-web:
cd src/interfaces/assistants_web && npm run generate:client && npm run format:write
.PHONY: install-web
install-web:
cd src/interfaces/assistants_web && npm install
.PHONY: build-web
build-web:
cd src/interfaces/assistants_web && npm run build
# Coral Web
.PHONY: format-coral
format-coral:
cd src/interfaces/coral_web && npm run format:write
.PHONY: generate-client-coral
generate-client-coral:
cd src/interfaces/coral_web && npm run generate:client && npm run format:write
.PHONY: install-coral
install-coral:
cd src/interfaces/coral_web && npm install
.PHONY: build-coral
build-coral:
cd src/interfaces/coral_web && npm run build
# Debugging
.PHONY: vscode-debug
vscode-debug:
@DEBUGGER_IDE=vscode docker compose -f docker-compose.debug.yml up --build
.PHONY: pycharm-debug
pycharm-debug:
@DEBUGGER_IDE=pycharm docker compose -f docker-compose.debug.yml up --build