-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (97 loc) · 4.34 KB
/
Makefile
File metadata and controls
120 lines (97 loc) · 4.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
# InQL — Incan library package
# =============================
#
# Requires `incan` on your PATH (build/install from the Incan compiler repository).
# CI builds Incan from source first; locally, use your own toolchain.
#
# Override the binary if needed: `make build INCAN=/path/to/incan`
INCAN ?= incan
export INCAN_NO_BANNER ?= 1
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show Make targets
@echo "\033[1mInQL\033[0m — typed relational layer (Incan library)."
@echo "Requires \033[36m$(INCAN)\033[0m on PATH, or set \033[36mINCAN=\033[0m/path/to/incan."
@echo ""
@grep -E '^[a-zA-Z0-9_.-]+:.*?##' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# =============================================================================
# Build & test (primary — Incan-first)
# =============================================================================
#
# Test discovery defaults to `.` and walks the whole tree. CI checks out the
# Incan compiler under `./incan/`; running `incan test` without a path would
# pick up compiler integration tests (e.g. `incan/tests/test_*.incn`), which
# are not InQL package tests. Scope to `tests/` only (see INQL_FMT_DIRS).
INQL_TEST_DIR := tests
.PHONY: build
build: ## Build the library (`incan build --lib`)
@echo "\033[1mBuilding InQL library...\033[0m"
@$(INCAN) build --lib
.PHONY: test
test: ## Run package tests (`incan test tests`)
@echo "\033[1mRunning InQL tests...\033[0m"
@$(INCAN) test $(INQL_TEST_DIR)
.PHONY: test-style
test-style: ## Validate test style markers (Arrange / Act / Assert) across `tests/*.incn`
@echo "\033[1mChecking test style markers...\033[0m"
@bash scripts/check_test_style.sh
.PHONY: build-locked
build-locked: ## Build with `--locked` (stricter; requires current `incan.lock`)
@echo "\033[1mBuilding InQL library (locked)...\033[0m"
@$(INCAN) build --lib --locked
.PHONY: test-locked
test-locked: ## Run tests with `--locked`
@echo "\033[1mRunning InQL tests (locked)...\033[0m"
@$(INCAN) test $(INQL_TEST_DIR) --locked
# =============================================================================
# Formatting (Incan source — package only)
# =============================================================================
#
# Scope to `src/`, `tests/`, and `examples/` only. CI checks out the Incan
# compiler under `./incan/`; formatting `.` would walk that tree and fail on
# stdlib snapshots and test fixtures that are not meant for `incan fmt`.
INQL_FMT_DIRS := src tests examples
.PHONY: fmt
fmt: ## Format package `.incn` sources (`incan fmt` per directory)
@echo "\033[1mFormatting Incan sources (package dirs)...\033[0m"
@for d in $(INQL_FMT_DIRS); do \
if [ -d "$$d" ]; then $(INCAN) fmt "$$d"; fi; \
done
.PHONY: fmt-check
fmt-check: ## Check formatting without writing (`incan fmt --check` per directory)
@echo "\033[1mChecking Incan source formatting (package dirs)...\033[0m"
@for d in $(INQL_FMT_DIRS); do \
if [ -d "$$d" ]; then \
echo "\033[1m -> $$d/\033[0m"; \
$(INCAN) fmt --check "$$d" || exit $$?; \
fi; \
done
# =============================================================================
# Aggregates (local gates)
# =============================================================================
.PHONY: check
check: fmt-check test-style build test ## Format check, style gate, build, and test
@echo "\033[32m✓ check passed\033[0m"
.PHONY: pre-commit
pre-commit: fmt-check test-style build test ## Fast gate before commit (same as `check`)
@echo "\033[32m✓ pre-commit gate passed\033[0m"
.PHONY: ci
ci: fmt-check test-style build test smoke-consumer ## Same steps as GitHub Actions `inql` job
@echo "\033[32m✓ ci gate passed\033[0m"
.PHONY: verify
verify: ci ## Alias for `ci`
.PHONY: smoke-consumer
smoke-consumer: ## Verify InQL works as a pub dependency from a fresh consumer project
@echo "\033[1mRunning pub-consumer smoke check...\033[0m"
@bash scripts/smoke_pub_consumer.sh
# =============================================================================
# Miscellaneous
# =============================================================================
.PHONY: version
version: ## Print `incan` version (requires toolchain on PATH)
@$(INCAN) --version
.PHONY: clean
clean: ## Remove Incan `target/` outputs under this package
@echo "\033[1mCleaning...\033[0m"
@rm -rf target
@echo "\033[32m✓ Clean\033[0m"