-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
72 lines (57 loc) · 1.85 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
PYTEST_FLAGS=-W error::SyntaxWarning
TEMP_TEST_OUTPUT=/tmp/sse-contract-test-service.log
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = launchdarkly-eventsource
SOURCEDIR = docs
BUILDDIR = $(SOURCEDIR)/build
.PHONY: help
help: #! Show this help message
@echo 'Usage: make [target] ... '
@echo ''
@echo 'Targets:'
@grep -h -F '#!' $(MAKEFILE_LIST) | grep -v grep | sed 's/:.*#!/:/' | column -t -s":"
.PHONY: install
install:
poetry install
#
# Quality control checks
#
.PHONY: test
test: #! Run unit tests
test: install
poetry run pytest $(PYTEST_FLAGS)
.PHONY: lint
lint: #! Run type analysis and linting checks
lint: install
@poetry run mypy ld_eventsource
@poetry run isort --check --atomic ld_eventsource contract-tests
@poetry run pycodestyle ld_eventsource contract-tests
#
# Documentation generation
#
.PHONY: docs
docs: #! Generate sphinx-based documentation
poetry install --with docs
cd docs
poetry run $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
#
# Contract test service commands
#
.PHONY: install-contract-tests-deps
install-contract-tests-deps:
poetry install --with contract-tests
.PHONY: start-contract-test-service
start-contract-test-service:
@cd contract-tests && poetry run python service.py
.PHONY: start-contract-test-service-bg
start-contract-test-service-bg:
@echo "Test service output will be captured in $(TEMP_TEST_OUTPUT)"
@make start-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 &
.PHONY: run-contract-tests
run-contract-tests:
@curl -s https://raw.githubusercontent.com/launchdarkly/sse-contract-tests/main/downloader/run.sh \
| VERSION=v2 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end" sh
.PHONY: contract-tests
contract-tests: #! Run the SSE contract test harness
contract-tests: install-contract-tests-deps start-contract-test-service-bg run-contract-tests