diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e5764a7..5533387 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,6 +19,7 @@ ## Testing - [ ] Tests pass (coverage โ‰ฅ 91%) - [ ] Manually tested +- [ ] `make docker-integration` passed locally *(required when touching `Dockerfile`, `entrypoint.sh`, `docker-compose.yml`, or `packages/parser-core/`)* ## Checklist - [ ] Code follows project style diff --git a/Makefile b/Makefile index 967523c..aad0917 100644 --- a/Makefile +++ b/Makefile @@ -360,7 +360,7 @@ show-retention-status: ## Show data retention status @python3 -c "from src.services.data_retention import DataRetentionService; from src.app import AppConfig; config = AppConfig.from_env(); service = DataRetentionService(config.data_retention_days, config.output_dir); files = service.find_expired_files(); print(f'Retention period: {config.data_retention_days} days'); print(f'Expired files: {len(files)}')" # Docker build modes -.PHONY: docker-local docker-remote docker-build docker-pull +.PHONY: docker-local docker-remote docker-build docker-pull docker-integration docker-local: ## Build and run from local code @echo "๐Ÿ”จ Building from local code..." @@ -379,6 +379,27 @@ docker-build: ## Build local image without running @cp .env.local .env docker-compose build +docker-integration: ## Build image and run integration test against input/ (requires PDFs in input/) + @echo "๐Ÿงช Running Docker integration test..." + @[ -d input ] && [ -n "$$(find input -name '*.pdf' 2>/dev/null | head -1)" ] || { echo "โŒ No PDFs found in input/ โ€” add statements first"; exit 1; } + @mkdir -p /tmp/docker-integration-output + @cp .env.local .env + @docker-compose build -q + @docker run --rm \ + -v "$$(pwd)/input:/app/input:ro" \ + -v "/tmp/docker-integration-output:/app/output" \ + -e EXIT_AFTER_PROCESSING=true \ + bankstatementsprocessor:latest + @python3 -c "\ +import json, glob, sys; \ +files = [f for f in glob.glob('/tmp/docker-integration-output/*.json') \ + if not any(x in f for x in ['summary','duplicate','expense','monthly','excluded','iban'])]; \ +total = sum(len(json.load(open(f))) for f in files); \ +print(f'Transactions extracted: {total}'); \ +sys.exit(0 if total > 0 else 1)" + @rm -rf /tmp/docker-integration-output + @echo "โœ… Docker integration test passed" + docker-pull: ## Pull remote image without running @cp .env.remote .env docker-compose pull