-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
323 lines (265 loc) · 8.34 KB
/
Makefile
File metadata and controls
323 lines (265 loc) · 8.34 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
include ./application/.env
export
sail := ./application/vendor/bin/sail
compose := docker-compose exec -T catalystexplorer.com
nodeVersion := 24.3.0
COMPOSE_FLAGS ?=
.PHONY: init
init:
cp ./application/.env.example ./application/.env
make backend-install
docker run --rm --interactive --tty \
--volume ${PWD}:/app \
--workdir /app \
--user root \
node:20-alpine yarn install --ignore-engine
docker run --rm --interactive --tty \
--volume ${PWD}/application:/app \
--workdir /app \
--user root \
node:${nodeVersion}-alpine yarn install --ignore-engine
docker run --rm -it \
-v ${PWD}/application:/app \
composer bash -c "composer config --global github-protocols https && composer install --ignore-platform-reqs"
sudo chown -R $(id -u -n):$(id -g -n) ${PWD}/application/vendor
make up
sleep 10
$(compose) php artisan key:generate
make migrate
$(compose) yarn husky init
.PHONY: artisan
artisan:
$(compose) artisan $(filter-out $@,$(MAKECMDGOALS))
.PHONY: backend-install
backend-install:
docker run --rm --interactive --tty \
--volume ${PWD}/application:/app \
composer install --ignore-platform-reqs
.PHONY: build
build:
$(compose) yarn build
.PHONY: tsc
tsc:
$(compose) npx tsc
.PHONY: db-setup
db-setup:
$(sail) artisan migrate:fresh --seed
.PHONY: db-seed
db-seed:
$(sail) artisan db:seed
.PHONY: down
down:
$(sail) down
.PHONY: ts-transform
ts-transform:
$(sail) artisan typescript:transform
.PHONY: db-schema
db-schema:
$(sail) node --loader ts-node/esm resources/js/scripts/generateDbSchema.ts
.PHONY: db-forward-preview
db-forward-preview:
kubect port-forward
.PHONY: devtools-install
devtools-install:
docker run --rm --interactive --tty \
--volume ${PWD}:/app \
--workdir /app \
--user root \
node:${nodeVersion}-alpine yarn install --ignore-engine
make up
npx husky init
echo 'npx --no -- commitlint --edit $$1' > .husky/commit-msg
chmod +x .husky/_/commit-msg
printf 'make lint-backend\ngit add -A\nmake tsc\nmake test-backend' > .husky/pre-commit
chmod +x .husky/pre-commit
.PHONY: frontend-install
frontend-install:
make frontend-clean
docker run --rm --interactive --tty \
--volume ${PWD}/application:/app \
--workdir /app \
--user root \
node:${nodeVersion}-alpine yarn install --ignore-engine --unsafe-perm=true
.PHONY: frontend-clean
frontend-clean:
rm -rf application/node_modules 2>/dev/null || true
.PHONY: image-build
image-build:
docker build \
--build-arg=WWWGROUP=1000 \
--build-arg=WWWUSER=1000 \
--build-arg=GITHUB_PACKAGE_REGISTRY_TOKEN=${GITHUB_PACKAGE_REGISTRY_TOKEN} \
-f ./docker/Dockerfile.dev \
-t catalystexplorer \
./docker/.
.PHONY: logs
lint-backend:
$(sail) pint app
.PHONY: logs
lint-frontend:
$(sail) yarn lint
.PHONY: logs
logs:
docker logs --follow catalystexplorer.com
.PHONY: migrate
migrate:
$(sail) php artisan migrate
.PHONY: restart
restart:
make down
make up
.PHONY: rm
rm:
$(sail) down -v
.PHONY: sh
sh:
$(sail) shell $(filter-out $@,$(MAKECMDGOALS))
# .PHONY: commitlint
# commitlint:
# npx --no -- commitlint --edit $1
.PHONY: status
status:
docker-compose ps
.PHONY: up
up:
$(sail) up -d --remove-orphans $(COMPOSE_FLAGS)
.PHONY: up-ext
up-ext:
$(sail) up -d --remove-orphans $(filter-out $@,$(MAKECMDGOALS))
.PHONY: vite
vite:
@echo "Starting Vite with increased memory limit..."
$(sail) node --max-old-space-size=4096 ./node_modules/.bin/vite --force
.PHONY: watch
watch:
docker-compose up -d --remove-orphans $(COMPOSE_FLAGS) && $(sail) npm run dev -- --force
.PHONY: watch-ext
watch-ext:
docker-compose up -d --remove-orphans $(filter-out $@,$(MAKECMDGOALS)) && $(sail) npx vite --force -- --unsafe-perm=true
.PHONY: test-backend
test-backend:
docker-compose -f docker-compose.testing.yml up -d && \
sleep 3 && \
docker-compose -f docker-compose.testing.yml exec -T catalystexplorer_test.com vendor/bin/pest --group=arch --parallel && \
sleep 3 && \
docker-compose -f docker-compose.testing.yml down --volumes
.PHONY: test-arch
test-arch:
make test-backend && \
make up
.PHONY: test-e2e
test-e2e:
@echo "Starting End-to-End Testing Workflow..."
@echo "Stopping Allure service if running..."
@docker-compose stop catalystexplorer.allure 2>/dev/null || true
@echo "Cleaning previous test results..."
@rm -rf ./application/allure-results ./application/allure-report ./application/allure-reports ./application/playwright-report 2>/dev/null || true
@echo "Creating fresh directories..."
@mkdir -p ./application/allure-results ./application/allure-reports
@echo "Starting Allure reporting service..."
@docker-compose up -d catalystexplorer.allure
@echo "Waiting for Allure service to be ready..."
@sleep 5
@echo "Installing Playwright browsers (if not already installed)..."
@cd ./application && npx playwright install --with-deps
@echo "Running Playwright E2E tests...
@cd ./application && \
if [ -n "$(FILE)" ]; then \
npx playwright test $(FILE); \
else \
npx playwright test; \
fi; \
TEST_EXIT_CODE=$$?; \
echo "Test reports are being generated automatically by Allure service..."; \
echo "Access your test reports at: http://localhost:5050/allure-docker-service/projects/default/reports/latest/index.html?redirect=false";
.PHONY: test-e2e-stop
test-e2e-stop:
@echo "Stopping Allure reporting service..."
@docker-compose stop catalystexplorer.allure
.PHONY: image-build-playwright
image-build-playwright:
docker build \
-f docker/Dockerfile.playwright \
-t catalystexplorer-playwright \
.
.PHONY: seed-index
seed-index:
$(sail) artisan db:seed --class=SearchIndexSeeder
.PHONY: create-index import-index flush-index
MODELS = App\\Models\\Voter App\\Models\\BookmarkCollection App\\Models\\ProjectSchedule App\\Models\\Community App\\Models\\Proposal App\\Models\\CatalystProfile App\\Models\\IdeascaleProfile App\\Models\\Group App\\Models\\Review App\\Models\\MonthlyReport App\\Models\\Transaction App\\Models\\VoterHistory
create-index:
@model_filter="$(filter-out $@,$(MAKECMDGOALS))"; \
model_filter="$$(echo $$model_filter | head -n1)"; \
if [ -z "$$model_filter" ]; then \
models="$(MODELS)"; \
else \
models="$$(echo $(MODELS) | tr ' ' '\n' | grep -i "$$model_filter")"; \
echo "$$models";\
fi; \
for model in $$models; do \
$(sail) artisan cx:create-search-index "$$model"; \
done
%:
@:
import-index:
@model_filter="$(filter-out $@,$(MAKECMDGOALS))"; \
model_filter="$$(echo $$model_filter | head -n1)"; \
if [ -z "$$model_filter" ]; then \
models="$(MODELS)"; \
else \
models="$$(echo $(MODELS) | tr ' ' '\n' | grep -i "$$model_filter")"; \
echo "$$models";\
fi; \
for model in $$models; do \
$(sail) artisan scout:import "$$model"; \
done
%:
@:
flush-index:
@model_filter="$(filter-out $@,$(MAKECMDGOALS))"; \
model_filter="$$(echo $$model_filter | head -n1)"; \
if [ -z "$$model_filter" ]; then \
models="$(MODELS)"; \
else \
models="$$(echo $(MODELS) | tr ' ' '\n' | grep -i "$$model_filter")"; \
echo "$$models";\
fi; \
for model in $$models; do \
$(sail) artisan scout:flush "$$model"; \
done
%:
@:
.PHONY: delete-index
INDEXES = cx_bookmark_collections cx_proposals cx_communities cx_catalyst_profiles cx_ideascale_profiles cx_monthly_reports cx_review cx_groups cx_transactions cx_communities cx_voter_histories
delete-index:
@index_filter="$(filter-out $@,$(MAKECMDGOALS))"; \
for index in $(INDEXES); do \
if [ -z "$$index_filter" ] || echo $$index | grep -i "$$index_filter" > /dev/null; then \
$(sail) artisan scout:delete-index "$$index"; \
fi \
done
%:
@:
# Ollama AI Commands
.PHONY: ollama-pull ollama-init ollama-status ollama-shell ollama-logs
ollama-pull:
@echo "Pulling llama3.3:70b model..."
docker-compose exec catalystexplorer.ollama ollama pull llama3.3:70b
ollama-init:
@echo "Initializing Ollama with model..."
docker-compose exec catalystexplorer.ollama /ollama-init.sh
ollama-status:
@echo "Checking Ollama status and available models..."
docker-compose exec catalystexplorer.ollama ollama list
ollama-shell:
@echo "Opening shell in Ollama container..."
docker-compose exec catalystexplorer.ollama /bin/bash
ollama-logs:
@echo "Showing Ollama container logs..."
docker logs --follow catalystexplorer.ollama
ollama-chat:
@echo "Starting interactive chat with llama3.3:70b..."
docker-compose exec -it catalystexplorer.ollama ollama run llama3.3:70b
ollama-restart:
@echo "Restarting Ollama service..."
docker-compose restart catalystexplorer.ollama