-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
59 lines (39 loc) · 1.58 KB
/
Makefile
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
deps: ## Install the dependencies of the backend
@cabal build --only-dependencies
build: ## Build the project in fast mode
@cd docs && mdbook build
@cabal build -j
clean: ## Remove compilation artifacts
@cabal clean
repl: ## Start a REPL
@cabal repl
watch: ## Reload the code on change
@ghcid
test: ## Run the test suite
@./scripts/run-tests.sh
lint: ## Run the code linter (HLint)
@find test src -name "*.hs" | xargs -P $(PROCS) -I {} hlint --refactor-options="-i" --refactor {}
style: ## Run the code styler (stylish-haskell)
@cabal-fmt -i *.cabal
@find docs/src test src -name "*.hs" | xargs -P $(PROCS) -I {} fourmolu -q --mode inplace {}
docs-build: ## Generate the documentation
@cabal run book -- process
docs-serve: ## Start a web server to serve the documentation
@cd docs; mdbook serve --open
doctest: ## Run the doctests
@cabal repl --with-ghc=doctest
db-create: ## Create the database
@createdb -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER) $(DB_DATABASE)
db-drop: ## Drop the database
@dropdb -f --if-exists -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER) $(DB_DATABASE)
db-setup: db-create db-init db-migrate ## Setup the dev database
db-init: ## Create the database schema
@migrate init "$(DB_CONNSTRING)"
db-migrate: ## Apply database migrations
@migrate migrate "$(DB_CONNSTRING)" test/migrations
db-reset: db-drop db-setup db-provision ## Reset the dev database
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.* ?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
PROCS := $(shell nproc)
.PHONY: all $(MAKECMDGOALS)
.DEFAULT_GOAL := help