-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (54 loc) · 1.83 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
61
62
63
64
65
66
67
68
69
70
PROJECT_ID := airflow-tdd-ci-workflow
SHELL := /bin/bash
VENV_DIR := ${CURDIR}/.venv/bin
VENV_PYTHON := ${VENV_DIR}/python
PYTEST_ARGS := ""
TAG := $(shell git rev-parse --short HEAD)
ENVIRONMENT := dev
include .env
.venv:
@python3 -m venv .venv
@${VENV_PYTHON} -m pip install -U -q pip pip-tools
.PHONY: install-deps
install-deps: .venv
@"${VENV_PYTHON}" -m pip install -r requirements.txt
.PHONY: isort-check
isort-check: install-deps
@${VENV_PYTHON} -m isort -c .
.PHONY: black-check
black-check: install-deps
@${VENV_PYTHON} -m black .
.PHONY: autoflake-check
autoflake-check: install-deps
@${VENV_PYTHON} -m autoflake -c --remove-unused-variables --remove-all-unused-imports -r dags tests &> /dev/null
.PHONY: mypy
mypy: install-deps
@${VENV_PYTHON} -m mypy
.PHONY: lint
lint: autoflake-check isort-check black-check mypy
.PHONY: isort
isort: install-deps
@${VENV_PYTHON} -m isort .
.PHONY: black
black: install-deps
@${VENV_PYTHON} -m black .
.PHONY: autoflake
autoflake: install-deps
@${VENV_PYTHON} -m autoflake --remove-unused-variables --remove-all-unused-imports -i -r -r dags tests
.PHONY: format
format: autoflake isort black
.PHONY: setup
setup:
docker-compose up -d --force-recreate --remove-orphans
sleep 240
docker exec airflow airflow users create --username admin --password admin --role Admin --firstname Paulo --lastname Chaves --email admin@email.com
docker exec airflow airflow connections add 'legacy' --conn-uri 'postgresql://root:root@legacy-database:5432/legacy'
docker exec airflow airflow connections add 'analytics' --conn-uri 'postgresql://root:root@analytics-database:5432/analytics'
.PHONY: down
down:
docker-compose down
.PHONY: test
test: format lint
docker exec airflow pytest --cov=./ --cov-report=xml ${PYTEST_ARGS}
docker cp airflow:/opt/airflow/coverage.xml .
docker cp airflow:/opt/airflow/.coverage .