|
| 1 | +.DEFAULT_GOAL := help |
| 2 | + |
| 3 | +# ── Pytest marker expression ─────────────────────────────────────── |
| 4 | +# Override on the command line: make test MARKER="integration" |
| 5 | +# Default excludes integration tests for everyday local development. |
| 6 | +MARKER ?= not integration |
| 7 | + |
| 8 | +# ── Video-related test paths (single source of truth) ────────────── |
| 9 | +# When you add a new video test file, add it here. Both test (via |
| 10 | +# --ignore) and test-video (via positional args) stay in sync. |
| 11 | +VIDEO_PATHS := \ |
| 12 | + getstream/video \ |
| 13 | + tests/rtc \ |
| 14 | + tests/test_audio_stream_track.py \ |
| 15 | + tests/test_connection_manager.py \ |
| 16 | + tests/test_connection_utils.py \ |
| 17 | + tests/test_signaling.py \ |
| 18 | + tests/test_video_examples.py \ |
| 19 | + tests/test_video_integration.py \ |
| 20 | + tests/test_video_openai.py \ |
| 21 | + tests/test_webrtc_generation.py |
| 22 | + |
| 23 | +# ── Manual tests (require local infrastructure, never run in CI) ─── |
| 24 | +MANUAL_PATHS := \ |
| 25 | + tests/test_tracing_jaeger_manual.py \ |
| 26 | + tests/test_metrics_prometheus_manual.py |
| 27 | + |
| 28 | +# ── Derived ignore flags ────────────────────────────────────────── |
| 29 | +VIDEO_IGNORE := $(addprefix --ignore=,$(VIDEO_PATHS)) |
| 30 | +MANUAL_IGNORE := $(addprefix --ignore=,$(MANUAL_PATHS)) |
| 31 | + |
| 32 | +# ── Typecheck exclusions ────────────────────────────────────────── |
| 33 | +TY_EXCLUDES := \ |
| 34 | + --exclude "getstream/models/" \ |
| 35 | + --exclude "getstream/video/rtc/pb/" \ |
| 36 | + --exclude "**/rest_client.py" \ |
| 37 | + --exclude "**/async_rest_client.py" \ |
| 38 | + --exclude "getstream/chat/channel.py" \ |
| 39 | + --exclude "getstream/chat/async_channel.py" \ |
| 40 | + --exclude "getstream/chat/client.py" \ |
| 41 | + --exclude "getstream/chat/async_client.py" \ |
| 42 | + --exclude "getstream/common/client.py" \ |
| 43 | + --exclude "getstream/common/async_client.py" \ |
| 44 | + --exclude "getstream/moderation/client.py" \ |
| 45 | + --exclude "getstream/moderation/async_client.py" \ |
| 46 | + --exclude "getstream/video/client.py" \ |
| 47 | + --exclude "getstream/video/async_client.py" \ |
| 48 | + --exclude "getstream/video/call.py" \ |
| 49 | + --exclude "getstream/video/async_call.py" \ |
| 50 | + --exclude "getstream/feeds/client.py" \ |
| 51 | + --exclude "getstream/feeds/feeds.py" \ |
| 52 | + --exclude "getstream/stream.py" |
| 53 | + |
| 54 | +# ── Targets ─────────────────────────────────────────────────────── |
| 55 | + |
| 56 | +.PHONY: test test-video test-all test-integration test-jaeger test-prometheus lint format typecheck check regen help |
| 57 | + |
| 58 | +## Run non-video tests (chat, feeds, moderation, etc.) |
| 59 | +test: |
| 60 | + uv run pytest -m "$(MARKER)" tests/ getstream/ $(VIDEO_IGNORE) $(MANUAL_IGNORE) |
| 61 | + |
| 62 | +## Run video/WebRTC tests only |
| 63 | +test-video: |
| 64 | + uv run pytest -m "$(MARKER)" $(VIDEO_PATHS) |
| 65 | + |
| 66 | +## Run all tests (non-video + video), excluding manual tests |
| 67 | +test-all: |
| 68 | + uv run pytest -m "$(MARKER)" tests/ getstream/ $(MANUAL_IGNORE) |
| 69 | + |
| 70 | +## Run integration tests for both groups |
| 71 | +test-integration: |
| 72 | + $(MAKE) test MARKER="integration" |
| 73 | + $(MAKE) test-video MARKER="integration" |
| 74 | + |
| 75 | +## Run the Jaeger tracing manual test (requires local Jaeger on :4317) |
| 76 | +test-jaeger: |
| 77 | + uv run pytest -m "integration" tests/test_tracing_jaeger_manual.py |
| 78 | + |
| 79 | +## Run the Prometheus metrics manual test (requires telemetry deps) |
| 80 | +test-prometheus: |
| 81 | + uv run pytest -m "integration" tests/test_metrics_prometheus_manual.py |
| 82 | + |
| 83 | +## Run Ruff linter and formatter check |
| 84 | +lint: |
| 85 | + uv run ruff check . |
| 86 | + uv run ruff format --check . |
| 87 | + |
| 88 | +## Auto-fix lint issues and format |
| 89 | +format: |
| 90 | + uv run ruff check --fix . |
| 91 | + uv run ruff format . |
| 92 | + |
| 93 | +## Run ty type checker |
| 94 | +typecheck: |
| 95 | + uvx ty@0.0.24 check getstream/ $(TY_EXCLUDES) |
| 96 | + |
| 97 | +## Run full check: lint + typecheck + non-video tests |
| 98 | +check: lint typecheck test |
| 99 | + |
| 100 | +## Regenerate all generated code (OpenAPI + WebRTC protobuf) |
| 101 | +regen: |
| 102 | + ./generate.sh |
| 103 | + ./generate_webrtc.sh |
| 104 | + |
| 105 | +## Show available targets |
| 106 | +help: |
| 107 | + @echo "Usage: make <target> [MARKER=\"...\"]" |
| 108 | + @echo "" |
| 109 | + @echo "Test targets:" |
| 110 | + @echo " test Non-video tests (default MARKER='not integration')" |
| 111 | + @echo " test-video Video/WebRTC tests only" |
| 112 | + @echo " test-all All tests except manual infrastructure tests" |
| 113 | + @echo " test-integration Integration tests (both non-video and video)" |
| 114 | + @echo " test-jaeger Jaeger tracing manual test (needs Docker Jaeger)" |
| 115 | + @echo " test-prometheus Prometheus metrics manual test (needs telemetry deps)" |
| 116 | + @echo "" |
| 117 | + @echo "Quality targets:" |
| 118 | + @echo " lint Ruff linter + format check" |
| 119 | + @echo " format Auto-fix lint issues and format code" |
| 120 | + @echo " typecheck ty type checker" |
| 121 | + @echo " check Full check: lint + typecheck + non-video tests" |
| 122 | + @echo "" |
| 123 | + @echo "Code generation:" |
| 124 | + @echo " regen Regenerate OpenAPI + WebRTC protobuf code" |
0 commit comments