-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (81 loc) · 3.35 KB
/
Copy pathMakefile
File metadata and controls
100 lines (81 loc) · 3.35 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
# trex top-level Makefile — convenience entry points for tests and coverage.
# Per-plugin builds live in plugins/*/Makefile; this file fans out.
RUST_PLUGINS := cache chdb db etl fhir hades hana migration pgt pgwire pool pool-client runtime tpm transform
TS_PACKAGES := plugins/notebook plugins/web plugins/studio
DENO_PACKAGES := core/server core/event plugins/postgrest
.PHONY: test test-rust test-integration test-frontend test-deno \
coverage coverage-rust coverage-integration coverage-frontend coverage-deno coverage-merge-all \
coverage-clean \
lint lint-python lint-js
# ---- Run every test layer ----
test: test-rust test-frontend test-deno test-integration
# ---- Code-quality lint (matches CodeQL quality suite). ----
lint: lint-python lint-js
lint-python:
@command -v ruff >/dev/null || { echo "ruff not installed: 'uv tool install ruff' or 'pip install ruff'"; exit 1; }
ruff check .
lint-js:
@command -v npx >/dev/null || { echo "node/npx required"; exit 1; }
npx --yes @biomejs/biome lint
test-rust:
@for p in $(RUST_PLUGINS); do \
if [ -f plugins/$$p/Cargo.toml ]; then \
echo "==> cargo test in plugins/$$p"; \
(cd plugins/$$p && cargo test --no-fail-fast) || exit $$?; \
fi; \
done
test-frontend:
@for pkg in $(TS_PACKAGES); do \
if [ -f $$pkg/package.json ]; then \
echo "==> npm test in $$pkg"; \
(cd $$pkg && npm test --silent --if-present) || exit $$?; \
fi; \
done
test-deno:
@for pkg in $(DENO_PACKAGES); do \
if [ -f $$pkg/deno.json ]; then \
echo "==> deno task test in $$pkg"; \
(cd $$pkg && deno task test 2>/dev/null || true); \
fi; \
done
test-integration:
$(MAKE) -C integration-tests test
# ---- Coverage ----
coverage: coverage-rust coverage-frontend coverage-deno coverage-merge-all
@echo "==> Coverage artifacts under build/coverage/ in each plugin and core/*"
coverage-rust:
@for p in $(RUST_PLUGINS); do \
if [ -f plugins/$$p/Makefile ] && grep -q "^coverage:" plugins/$$p/Makefile; then \
echo "==> coverage in plugins/$$p"; \
$(MAKE) -C plugins/$$p coverage || exit $$?; \
fi; \
done
coverage-frontend:
@for pkg in $(TS_PACKAGES); do \
if [ -f $$pkg/package.json ]; then \
echo "==> npm run test:coverage in $$pkg"; \
(cd $$pkg && npm run test:coverage --silent --if-present) || exit $$?; \
fi; \
done
coverage-deno:
@for pkg in $(DENO_PACKAGES); do \
if [ -f $$pkg/deno.json ]; then \
echo "==> deno task coverage in $$pkg"; \
(cd $$pkg && deno task coverage 2>/dev/null || true); \
fi; \
done
# Convenience: render a merged HTML report (requires genhtml from lcov)
coverage-merge-all:
@mkdir -p build/coverage
@find plugins core -name "lcov.info" -path "*/coverage/*" 2>/dev/null | xargs -I{} cat {} > build/coverage/merged.lcov 2>/dev/null || true
@if command -v genhtml >/dev/null 2>&1 && [ -s build/coverage/merged.lcov ]; then \
genhtml -q --output-directory build/coverage/html build/coverage/merged.lcov; \
echo "==> HTML report: build/coverage/html/index.html"; \
else \
echo "==> Skipping HTML render (genhtml not installed or no lcov data)"; \
fi
coverage-clean:
@for p in $(RUST_PLUGINS); do rm -rf plugins/$$p/build/coverage; done
@for pkg in $(TS_PACKAGES); do rm -rf $$pkg/coverage; done
@for pkg in $(DENO_PACKAGES); do rm -rf $$pkg/coverage; done
rm -rf integration-tests/coverage build/coverage