This repository was archived by the owner on Sep 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (68 loc) · 2.6 KB
/
Makefile
File metadata and controls
83 lines (68 loc) · 2.6 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
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
define run_migrations ## run migrations
@- mkdir instance
@ venv/bin/yoyo-migrate apply --all --batch
endef
define test_libgit ## Test libgit library
echo "[*] testing libgit"
cd libgit && cargo test --all --all-features --no-fail-fast
endef
define test_api_spec ## Test openapi specsheet
@cd ./docs/openapi/ && yarn install
@cd ./docs/openapi/ && yarn test
endef
define test_interface ## Run interface tests
$(call run_migrations)
@ . ./venv/bin/activate && pip install -e .
@ . ./venv/bin/activate && pip install '.[test]'
@ . ./venv/bin/activate && \
DYNACONF_SERVER__DOMAIN="http://interface.example.com" \
ENV_FOR_DYNACONF=testing \
coverage run -m pytest && coverage html
@ . ./venv/bin/activate && pip uninstall -y interface > /dev/null
endef
default: ## Run app
. ./venv/bin/activate && cd libgit && maturin build
. ./venv/bin/activate && python -m interface
coverage:
# rustup component add llvm-tools-preview is required
$(call test_interface)
@. ./venv/bin/activate && ./scripts/coverage.sh --coverage
@. ./venv/bin/activate && coverage xml && coverage html
@. ./venv/bin/activate && ./scripts/coverage.sh --coverage
doc: ## Generates documentation
@-rm -rf dist
@-mkdir -p dist/openapi/
@cd ./docs/openapi/ && yarn install && yarn html
@cp -r ./docs/openapi/dist/* dist/openapi/
docker: ## Build Docker image from source
docker build -t forgedfed/interface .
env: ## Install all dependencies
@-virtualenv venv
. ./venv/bin/activate && pip install maturin
. ./venv/bin/activate && cd libgit && maturin develop
. ./venv/bin/activate && pip install -r requirements.txt
# . ./venv/bin/activate && pip install -e .
#. ./venv/bin/activate && pip install '.[test]'
freeze: ## Freeze python dependencies
@. ./venv/bin/activate && pip freeze > requirements.txt
@-sed -i 's/.*fedv2\/interface.*/.\//' requirements.txt
@-sed -i '/libgit.*/d' requirements.txt
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
i: ## Launch app.py in an interactive python shell
python -i ./interface/__init__.py
lint: ## Run linter
@./venv/bin/black ./interface/*
@./venv/bin/black ./tests/*
@./venv/bin/black ./migrations/*
@./venv/bin/black setup.py
. ./venv/bin/activate && ./scripts/spellcheck.sh --check #--write
migrate: ## Run migrations
$(call run_migrations)
test: ## Run tests
@. ./venv/bin/activate && ./scripts/spellcheck.sh --check
$(call test_api_spec)
$(call test_libgit)
$(call test_interface)
test-interface: ## Run interface tests
$(call test_interface)