|
1 | 1 | .DEFAULT_GOAL := help |
2 | | -.PHONY: help install install-dev lint lint-fix format format-md typecheck quality test test-parallel test-teardown docs-serve docs-build docs-clean build clean all dev |
| 2 | +.PHONY: help install install-dev lint lint-fix format format-md typecheck quality test test-parallel test-migrate test-teardown docs-serve docs-build docs-clean build clean all dev |
3 | 3 |
|
4 | 4 | # Colors for output |
5 | 5 | YELLOW := \033[33m |
@@ -86,6 +86,35 @@ test-parallel: ## Run tests in parallel on 4 instances (auto-starts if needed) |
86 | 86 | fi |
87 | 87 | $(PYTEST) -n 4 --port $(word 1,$(TEST_PORTS)) --port $(word 2,$(TEST_PORTS)) --port $(word 3,$(TEST_PORTS)) --port $(word 4,$(TEST_PORTS)) tests/lua/ |
88 | 88 |
|
| 89 | +test-migrate: ## Run replay.py on all JSONL files in tests/runs/ using 4 parallel instances |
| 90 | + @echo "$(YELLOW)Running replay migration on tests/runs/ files...$(RESET)" |
| 91 | + @running_count=$$($(BALATRO_SCRIPT) --status | grep -E "($(word 1,$(TEST_PORTS))|$(word 2,$(TEST_PORTS))|$(word 3,$(TEST_PORTS))|$(word 4,$(TEST_PORTS)))" | wc -l); \ |
| 92 | + if [ "$$running_count" -ne 4 ]; then \ |
| 93 | + echo "Starting Balatro instances on ports: $(TEST_PORTS)"; \ |
| 94 | + $(BALATRO_SCRIPT) --headless --fast -p $(word 1,$(TEST_PORTS)) -p $(word 2,$(TEST_PORTS)) -p $(word 3,$(TEST_PORTS)) -p $(word 4,$(TEST_PORTS)); \ |
| 95 | + sleep 1; \ |
| 96 | + fi |
| 97 | + @jsonl_files=$$(find tests/runs -name "*.jsonl" -not -name "*.skip" | sort); \ |
| 98 | + if [ -z "$$jsonl_files" ]; then \ |
| 99 | + echo "$(RED)No .jsonl files found in tests/runs/$(RESET)"; \ |
| 100 | + exit 1; \ |
| 101 | + fi; \ |
| 102 | + file_count=$$(echo "$$jsonl_files" | wc -l); \ |
| 103 | + echo "Found $$file_count .jsonl files to process"; \ |
| 104 | + ports=($(TEST_PORTS)); \ |
| 105 | + port_idx=0; \ |
| 106 | + for file in $$jsonl_files; do \ |
| 107 | + port=$${ports[$$port_idx]}; \ |
| 108 | + echo "Processing $$file on port $$port..."; \ |
| 109 | + $(PYTHON) bots/replay.py --input "$$file" --port $$port & \ |
| 110 | + port_idx=$$((port_idx + 1)); \ |
| 111 | + if [ $$port_idx -eq 4 ]; then \ |
| 112 | + port_idx=0; \ |
| 113 | + fi; \ |
| 114 | + done; \ |
| 115 | + wait; \ |
| 116 | + echo "$(GREEN)✓ All replay migrations completed$(RESET)" |
| 117 | + |
89 | 118 | test-teardown: ## Kill all Balatro instances |
90 | 119 | @echo "$(YELLOW)Killing all Balatro instances...$(RESET)" |
91 | 120 | $(BALATRO_SCRIPT) --kill |
|
0 commit comments