-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
85 lines (62 loc) · 1.98 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
71
72
73
74
75
76
77
78
79
80
81
82
83
NAME := ldap2db
FOLDERS := ./app/ ./tests/
.DEFAULT_GOAL := help
.PHONY: help
help:
@echo "Available make commands:"
@echo ""
@echo " install install packages and prepare environment"
@echo " clean remove all temporary files"
@echo " lint run the code linters"
@echo " format reformat code"
@echo " test run all the tests"
@echo " dockertest run all the tests in docker image like jenkins"
@echo " coverage run tests and generate coverage report"
@echo " sync start Teamleader sync directly"
@echo " server start uvicorn development server fast-api for synchronizing with ldap"
@echo ""
.PHONY: install
install:
mkdir -p python_env; \
python3 -m venv python_env; \
. python_env/bin/activate; \
python3 -m pip install --upgrade pip; \
python3 -m pip install -r requirements.txt; \
python3 -m pip install -r requirements-test.txt
.PHONY: clean
clean:
find . -type d -name "__pycache__" | xargs rm -rf {}; \
rm -rf .coverage htmlcov
.PHONY: lint
lint:
@. python_env/bin/activate; \
flake8 --max-line-length=120 --exclude=.git,python_env,__pycache__
.PHONY: format
format:
@. python_env/bin/activate; \
autopep8 --in-place -r app; \
autopep8 --in-place -r tests;
.PHONY: test
test:
@. python_env/bin/activate; \
cp config.yml.tst config.yml && \
python -m pytest
.PHONY: dockertest
dockertest:
docker build . -t ldap2db; \
docker container run --name ldap2db --env-file .env.example --entrypoint python "ldap2db" "-m" "pytest"
.PHONY: coverage
coverage:
@. python_env/bin/activate; \
python -m pytest --cov-config=.coveragerc --cov . . --cov-report html --cov-report term
.PHONY: sync
sync:
. python_env/bin/activate; \
python -m app.app teamleader-sync
.PHONY: code_callback_example
code_callback_example:
curl "http://localhost:8080/sync/oauth?code=CODE_HERE&state=qas_secret_state"
.PHONY: server
server:
. python_env/bin/activate; \
uvicorn app.server:app --reload --port 8080 --no-access-log --reload-dir app