-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (79 loc) · 2.6 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Configuration
APP_ROOT := $(abspath $(lastword $(MAKEFILE_LIST))/..)
APP_NAME := nandu
export PYGEOAPI_CONFIG=pygeoapi-config.yml
export PYGEOAPI_OPENAPI=pygeoapi-openapi.yml
# end of configuration
.DEFAULT_GOAL := help
.PHONY: all
all: help
.PHONY: help
help:
@echo "Please use 'make <target>' where <target> is one of:"
@echo " help to print this help message. (Default)"
@echo " install to install app by running 'pip install -e .'"
@echo " start to start $(APP_NAME) service as daemon (background process)."
@echo " clean to remove all files generated by build and tests."
@echo "\nTesting targets:"
@echo " test to run tests (but skip long running tests)."
@echo " lint to run code style checks with ruff."
@echo "\nDocs targets:"
@echo " docs to build docs with mkdocs."
## Build targets
.PHONY: install
install:
@echo "Installing application ..."
@-bash -c 'flit install --deps all'
@echo "\nStart service with \`make start'"
.PHONY: config
config:
@echo "Configure application ..."
@-bash -c 'pygeoapi openapi generate $$PYGEOAPI_CONFIG --output-file $$PYGEOAPI_OPENAPI'
.PHONY: start
start: config
@echo "Starting application ..."
@-bash -c "pygeoapi serve"
.PHONY: clean
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
.PHONY: clean-build
clean-build:
@echo "Removing build artifacts ..."
@-rm -fr build/
@-rm -fr dist/
@-rm -fr .eggs/
@-find . -name '*.egg-info' -exec rm -fr {} +
@-find . -name '*.egg' -exec rm -f {} +
@-find . -name '*.log' -exec rm -fr {} +
@-find . -name '*.sqlite' -exec rm -fr {} +
.PHONY: clean-pyc
clean-pyc:
@echo "Removing Python file artifacts ..."
@-find . -name '*.pyc' -exec rm -f {} +
@-find . -name '*.pyo' -exec rm -f {} +
@-find . -name '*~' -exec rm -f {} +
@-find . -name '__pycache__' -exec rm -fr {} +
.PHONY: clean-test
clean-test:
@echo "Removing test artifacts ..."
@-rm -fr .pytest_cache
.PHONY: clean-dist
clean-dist: clean
@echo "Running 'git clean' ..."
@git diff --quiet HEAD || echo "There are uncommitted changes! Aborting 'git clean' ..."
## do not use git clean -e/--exclude here, add them to .gitignore instead
@-git clean -dfx
## Linting targets
.PHONY: lint
lint: ## check style with ruff
@echo "Running code style checks ..."
@bash -c 'ruff check src tests'
## Test targets
.PHONY: test
test:
@echo "Running tests (skip slow and online tests) ..."
@bash -c 'pytest -v -m "not slow and not online" tests/'
## Docs targests
.PHONY: docs
docs:
@echo "Building docs ..."
@bash -c 'mkdocs build'