-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (52 loc) · 1.45 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
60
#!make
SHELL:=/bin/bash
# pp - pretty print function
yellow := $(shell tput setaf 3)
normal := $(shell tput sgr0)
define pp
@printf '$(yellow)$(1)$(normal)\n'
endef
.PHONY: help
help: Makefile
@echo " Choose a command to run:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
# ## withenv: 🍝 `make` executes every line as a new shell. this is a workaround. `make withenv RECIPE=init`
# .PHONY: withenv
# withenv:
# test -e .env || cp .env.example .env
# . .venv/bin/activate
# bash -c 'set -o allexport; source .env; set +o allexport; make "$$RECIPE"'
## db: 💾 start a containerised database
.PHONY: db
db:
docker compose -p bi5importer up -d && docker ps
## init: ⚙️
.PHONY: init
init:
@echo "⏱ Intializing app..."
python3 -m venv .venv
@echo "📦 Fetching dependencies..."
. .venv/bin/activate; \
pip install -r requirements.txt
@echo "🪀 Applying database migrations..."
. .env && yoyo apply --database postgresql://$$DB_USER:$$DB_PASSWORD@$$DB_HOST:$$DB_PORT/$$DB_NAME
@echo "✅ Init complete"
## run: 💨
.PHONY: run
run:
. .venv/bin/activate; \
python bi5importer.py --path=test_data
## test: 🧪
.PHONY: test
test:
COVERAGE_FILE=coverage/.coverage \
pytest --cov=src \
--cov-report annotate:coverage/cov_annotate \
--cov-report html:coverage/cov_html \
--cov-report json:coverage/cov.json \
--cov-report lcov:coverage/cov.info \
--cov-report xml:coverage/cov.xml
## lint: 🧪
.PHONY: lint
lint:
pylint ./src