-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (74 loc) · 2.97 KB
/
Copy pathMakefile
File metadata and controls
89 lines (74 loc) · 2.97 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
SHELL := /bin/bash
.PHONY: bootstrap build lint test \
go-build go-test go-lint \
rust-check rust-test \
web-build web-lint \
scoring scoring-linux-amd64 scoring-linux-arm64
# ---------------------------------------------------------------------------
# Developer bootstrap
# ---------------------------------------------------------------------------
bootstrap:
pnpm install
go work sync
pnpm exec lefthook install
$(MAKE) build
# ---------------------------------------------------------------------------
# Aggregate targets
# ---------------------------------------------------------------------------
build: go-build rust-check web-build
lint: go-lint rust-check web-lint
test: go-test rust-test
# ---------------------------------------------------------------------------
# Go
# ---------------------------------------------------------------------------
go-build:
go build ./...
go-test:
cd apps/api && go test ./... -race -count=1
cd libs/go-scoring && go test ./...
go-lint:
cd apps/api && go vet ./...
@if command -v staticcheck >/dev/null 2>&1; then \
cd apps/api && staticcheck ./...; \
else \
echo "staticcheck not installed — skipping (run: go install honnef.co/go/tools/cmd/staticcheck@latest)"; \
fi
# ---------------------------------------------------------------------------
# Rust
# ---------------------------------------------------------------------------
rust-check:
cd crates && cargo fmt --all -- --check
cd crates && cargo clippy --workspace --all-targets -- -D warnings
cd crates && cargo check --workspace
rust-test:
cd crates && cargo test --workspace
# ---------------------------------------------------------------------------
# Web
# ---------------------------------------------------------------------------
web-build:
pnpm --filter @readinova/web build
web-lint:
pnpm --filter @readinova/web lint
pnpm --filter @readinova/web exec tsc --noEmit
# ---------------------------------------------------------------------------
# Scoring cdylib (native)
# ---------------------------------------------------------------------------
scoring:
cd crates && cargo build --release -p scoring
@mkdir -p libs/go-scoring/lib
@OS=$$(uname -s | tr '[:upper:]' '[:lower:]'); \
if [ "$$OS" = "darwin" ]; then \
cp crates/target/release/libscoring.dylib libs/go-scoring/lib/libscoring.dylib; \
echo "Copied libscoring.dylib"; \
else \
cp crates/target/release/libscoring.so libs/go-scoring/lib/libscoring.so; \
echo "Copied libscoring.so"; \
fi
scoring-linux-amd64:
cd crates && cargo build --release -p scoring --target x86_64-unknown-linux-gnu
@mkdir -p libs/go-scoring/lib/linux-amd64
@cp crates/target/x86_64-unknown-linux-gnu/release/libscoring.so libs/go-scoring/lib/linux-amd64/
scoring-linux-arm64:
cd crates && cargo build --release -p scoring --target aarch64-unknown-linux-gnu
@mkdir -p libs/go-scoring/lib/linux-arm64
@cp crates/target/aarch64-unknown-linux-gnu/release/libscoring.so libs/go-scoring/lib/linux-arm64/