Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (48 loc) · 2.15 KB
/
Copy pathMakefile
File metadata and controls
58 lines (48 loc) · 2.15 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
# =============================================================================
# squealgen Makefile
# =============================================================================
#
# Validation contract:
# - `make test`: Local development validation (drift check + full test suite)
# - `make ci`: CI validation (drift check + reduced property tests for runtime)
#
# Note: There is no coverage gate. Coverage is not meaningful for this project
# because the core logic is in squealgen.sql (a psql script), not Haskell code.
# The Haskell test suite exercises the generator, but measuring line coverage
# of test harness code doesn't reflect generator correctness.
#
# =============================================================================
testTargets := $(subst /schemas,,$(patsubst %/structure.sql,%.hs,$(wildcard test/*/schemas/*/structure.sql)))
squealgen: squealgen.sql mksquealgen.sh
./mksquealgen.sh
install: squealgen
install squealgen $(prefix)/bin/squealgen
.PHONY: check-squealgen-drift
check-squealgen-drift: squealgen.sql mksquealgen.sh
./check_squealgen_drift.sh
.PHONY: test
test: check-squealgen-drift squealgen $(testTargets)
@echo "testtargets: " $(testTargets)
cabal test --test-show-details=direct --ghc-option=-fprint-potential-instances
.PHONY: ci
ci: check-squealgen-drift squealgen $(testTargets)
@echo "Validation contract [ci]: running cabal test (reduced falsify cases)"
cabal test --test-show-details=direct --ghc-option=-fprint-potential-instances --test-options="--falsify-tests 25"
foo:
echo $(testTargets)
clean:
rm $(testTargets)
.PHONY: initdb_exists
initdb_exists:
which initdb
testwatch: initdb_exists
while true; do \
make test; \
inotifywait -r -e modify -e create -e delete -e move $$(find test -iname '*.hs' | grep -v '#' | grep -v Schema.hs) $$(find . -iname '*\.sql' | grep -v '#' ) squealgen.sql mksquealgen.sh Makefile cabal.project package.yaml ;\
done
# todo: bomb out if `schema` doesn't exist.
%.hs: schemas/%/structure.sql schemas/%/extra_imports squealgen
./buildTestSchema.sh $(dir $*) $(notdir $*)
.PHONY: install-exe
install-exe:
cabal install exe:squealgen --installdir=$(prefix)/bin --overwrite-policy=always