|
1 |
| - |
2 | 1 | PYTEST_FLAGS=-W error::SyntaxWarning
|
3 | 2 |
|
4 |
| -test: |
5 |
| - LD_SKIP_DATABASE_TESTS=1 pytest $(PYTEST_FLAGS) |
6 |
| - |
7 |
| -test-all: |
8 |
| - pytest $(PYTEST_FLAGS) |
9 |
| - |
10 |
| -lint: |
11 |
| - mypy --install-types --non-interactive --config-file mypy.ini ldclient testing |
12 |
| - |
13 |
| -docs: |
14 |
| - cd docs && make html |
15 |
| - |
16 |
| -.PHONY: test test-all lint docs |
17 |
| - |
18 |
| - |
19 | 3 | TEMP_TEST_OUTPUT=/tmp/contract-test-service.log
|
20 | 4 |
|
21 |
| -# TEST_HARNESS_PARAMS can be set to add -skip parameters for any contract tests that cannot yet pass |
22 |
| -# TEST_HARNESS_PARAMS := $(TEST_HARNESS_PARAMS) \ |
23 |
| -
|
24 |
| - |
| 5 | +SPHINXOPTS = -W --keep-going |
| 6 | +SPHINXBUILD = sphinx-build |
| 7 | +SPHINXPROJ = launchdarkly-server-sdk |
| 8 | +SOURCEDIR = docs |
| 9 | +BUILDDIR = $(SOURCEDIR)/build |
25 | 10 | # port 8000 and 9000 is already used in the CI environment because we're
|
26 | 11 | # running a DynamoDB container and an SSE contract test
|
27 | 12 | PORT=10000
|
28 | 13 |
|
29 |
| -build-contract-tests: |
30 |
| - @cd contract-tests && pip install -r requirements.txt |
31 |
| - |
| 14 | +.PHONY: help |
| 15 | +help: #! Show this help message |
| 16 | + @echo 'Usage: make [target] ... ' |
| 17 | + @echo '' |
| 18 | + @echo 'Targets:' |
| 19 | + @grep -h -F '#!' $(MAKEFILE_LIST) | grep -v grep | sed 's/:.*#!/:/' | column -t -s":" |
| 20 | + |
| 21 | +.PHONY: install |
| 22 | +install: |
| 23 | + @poetry install --all-extras |
| 24 | + |
| 25 | +# |
| 26 | +# Quality control checks |
| 27 | +# |
| 28 | + |
| 29 | +.PHONY: test |
| 30 | +test: #! Run unit tests |
| 31 | +test: install |
| 32 | + @poetry run pytest $(PYTEST_FLAGS) |
| 33 | + |
| 34 | +.PHONY: lint |
| 35 | +lint: #! Run type analysis and linting checks |
| 36 | +lint: install |
| 37 | + @poetry run mypy ldclient testing |
| 38 | + |
| 39 | +# |
| 40 | +# Documentation generation |
| 41 | +# |
| 42 | + |
| 43 | +.PHONY: docs |
| 44 | +docs: #! Generate sphinx-based documentation |
| 45 | + @poetry install --with docs |
| 46 | + @cd docs |
| 47 | + @poetry run $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 48 | + |
| 49 | +# |
| 50 | +# Contract test service commands |
| 51 | +# |
| 52 | + |
| 53 | +.PHONY: install-contract-tests-deps |
| 54 | +install-contract-tests-deps: |
| 55 | + poetry install --with contract-tests |
| 56 | + |
| 57 | +.PHONY: start-contract-test-service |
32 | 58 | start-contract-test-service:
|
33 |
| - @cd contract-tests && python service.py $(PORT) |
| 59 | + @cd contract-tests && poetry run python service.py $(PORT) |
34 | 60 |
|
| 61 | +.PHONY: start-contract-test-service-bg |
35 | 62 | start-contract-test-service-bg:
|
36 | 63 | @echo "Test service output will be captured in $(TEMP_TEST_OUTPUT)"
|
37 | 64 | @make start-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 &
|
38 | 65 |
|
| 66 | +.PHONY: run-contract-tests |
39 | 67 | run-contract-tests:
|
40 |
| - curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/v2/downloader/run.sh \ |
41 |
| - | VERSION=v2 PARAMS="-url http://localhost:$(PORT) -debug -stop-service-at-end $(TEST_HARNESS_PARAMS)" sh |
| 68 | + @curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/v2/downloader/run.sh \ |
| 69 | + | VERSION=v2 PARAMS="-url http://localhost:$(PORT) -debug -stop-service-at-end" sh |
| 70 | + |
| 71 | +.PHONY: contract-tests |
| 72 | +contract-tests: #! Run the contract test harness |
| 73 | +contract-tests: install-contract-tests-deps start-contract-test-service-bg run-contract-tests |
| 74 | + |
| 75 | +# |
| 76 | +# SSE contract test service commands |
| 77 | +# |
| 78 | + |
| 79 | +.PHONY: install-sse-contract-tests-deps |
| 80 | +install-sse-contract-tests-deps: |
| 81 | + poetry install --with contract-tests |
| 82 | + |
| 83 | +.PHONY: start-sse-contract-test-service |
| 84 | +start-sse-contract-test-service: |
| 85 | + @cd sse-contract-tests && poetry run python service.py $(PORT) |
| 86 | + |
| 87 | +.PHONY: start-sse-contract-test-service-bg |
| 88 | +start-sse-contract-test-service-bg: |
| 89 | + @echo "Test service output will be captured in $(TEMP_TEST_OUTPUT)" |
| 90 | + @make start-sse-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 & |
42 | 91 |
|
43 |
| -contract-tests: build-contract-tests start-contract-test-service-bg run-contract-tests |
| 92 | +.PHONY: run-sse-contract-tests |
| 93 | +run-sse-contract-tests: |
| 94 | + @curl -s https://raw.githubusercontent.com/launchdarkly/sse-contract-tests/v2.0.0/downloader/run.sh \ |
| 95 | + | VERSION=v1 PARAMS="-url http://localhost:$(PORT) -debug -stop-service-at-end -skip reconnection" sh |
44 | 96 |
|
45 |
| -.PHONY: build-contract-tests start-contract-test-service run-contract-tests contract-tests |
| 97 | +.PHONY: sse-contract-tests |
| 98 | +sse-contract-tests: #! Run the sse contract test harness |
| 99 | +sse-contract-tests: install-sse-contract-tests-deps start-sse-contract-test-service-bg run-sse-contract-tests |
0 commit comments