Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ CVSS
falkordb
pipenv
Pipenv
README
md
UI
86 changes: 86 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: E2E Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

permissions:
contents: read

jobs:
e2e-tests:
runs-on: ubuntu-latest

services:
falkordb:
image: falkordb/falkordb:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv

- name: Install dependencies
run: |
pipenv sync --dev

- name: Install Playwright browsers
run: |
pipenv run playwright install chromium
pipenv run playwright install-deps

- name: Create test environment file
run: |
cp .env.example .env
echo "FALKORDB_HOST=localhost" >> .env
echo "FALKORDB_PORT=6379" >> .env
echo "FLASK_SECRET_KEY=test-secret-key-for-ci" >> .env
echo "FLASK_DEBUG=False" >> .env

- name: Wait for FalkorDB
run: |
until docker exec "$(docker ps -q --filter ancestor=falkordb/falkordb:latest)" redis-cli ping; do
echo "Waiting for FalkorDB..."
sleep 2
done

- name: Run E2E tests
run: |
pipenv run pytest tests/e2e/ --browser chromium --video=on --screenshot=on
env:
CI: true

- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: |
test-results/
playwright-report/
retention-days: 30

- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: tests/e2e/screenshots/
retention-days: 30
10 changes: 5 additions & 5 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv

- name: Install dependencies
run: |
pipenv sync --dev

- name: Run pylint
run: |
pipenv run pylint $(git ls-files '*.py')
121 changes: 121 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

permissions:
contents: read

jobs:
unit-tests:
runs-on: ubuntu-latest

services:
falkordb:
image: falkordb/falkordb:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv

- name: Install dependencies
run: |
pipenv sync --dev

- name: Create test environment file
run: |
cp .env.example .env
echo "FLASK_SECRET_KEY=test-secret-key" >> .env
echo "FLASK_DEBUG=False" >> .env

- name: Run unit tests
run: |
pipenv run pytest tests/ -k "not e2e" --verbose

- name: Run pylint
run: |
pipenv run pylint "$(git ls-files '*.py')" || true

e2e-tests:
runs-on: ubuntu-latest
needs: unit-tests

services:
falkordb:
image: falkordb/falkordb:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv

- name: Install dependencies
run: |
pipenv sync --dev

- name: Install Playwright browsers
run: |
pipenv run playwright install chromium
pipenv run playwright install-deps

- name: Create test environment file
run: |
cp .env.example .env
echo "FALKORDB_HOST=localhost" >> .env
echo "FALKORDB_PORT=6379" >> .env
echo "FLASK_SECRET_KEY=test-secret-key-for-ci" >> .env
echo "FLASK_DEBUG=False" >> .env

- name: Wait for FalkorDB
run: |
timeout 60 bash -c 'until docker exec "$(docker ps -q --filter ancestor=falkordb/falkordb:latest)" redis-cli ping; do sleep 2; done'

- name: Run E2E tests
run: |
pipenv run pytest tests/e2e/ --browser chromium
env:
CI: true

- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: |
test-results/
playwright-report/
retention-days: 30
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@
*_conf*
.ruff_code/
.vercel/

# Test artifacts
test-results/
playwright-report/
tests/e2e/screenshots/*.png
.pytest_cache/

# Temporary test files
*.tmp
tmp_*
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.PHONY: help install test test-unit test-e2e test-e2e-headed lint format clean setup-dev

Comment on lines +1 to +2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Declare a default all target and keep the .PHONY list in sync

GNU Make expects an all target in most projects; several tools assume it’s the canonical entry-point.
Additionally, the .PHONY declaration is missing the targets that appear later in the file (run-dev, run-prod, docker-falkordb, docker-stop) so they can be shadowed by files or directories of the same name.

-.PHONY: help install test test-unit test-e2e test-e2e-headed lint format clean setup-dev
+.PHONY: all help install test test-unit test-e2e test-e2e-headed lint format clean \
+        setup-dev run-dev run-prod docker-falkordb docker-stop
+
+all: test            ## Default target: run the full test suite
🧰 Tools
🪛 checkmake (0.2.2)

[warning] 1-1: Missing required phony target "all"

(minphony)

🤖 Prompt for AI Agents
In the Makefile at lines 1 to 2, add a default target named `all` as the first
target in the file to serve as the canonical entry point. Also, update the
`.PHONY` declaration to include all targets defined later in the file such as
`run-dev`, `run-prod`, `docker-falkordb`, and `docker-stop` to prevent conflicts
with files or directories of the same names.

help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install dependencies
pipenv sync --dev

setup-dev: install ## Set up development environment
pipenv run playwright install chromium
pipenv run playwright install-deps
@echo "Development environment setup complete!"
@echo "Don't forget to copy .env.example to .env and configure your settings"

test: test-unit test-e2e ## Run all tests

test-unit: ## Run unit tests only
pipenv run pytest tests/ -k "not e2e" --verbose

test-e2e: ## Run E2E tests headless
pipenv run pytest tests/e2e/ --browser chromium

test-e2e-headed: ## Run E2E tests with browser visible
pipenv run pytest tests/e2e/ --browser chromium --headed

test-e2e-debug: ## Run E2E tests with debugging enabled
pipenv run pytest tests/e2e/ --browser chromium --slowmo=1000

lint: ## Run linting
pipenv run pylint $(shell git ls-files '*.py')

format: ## Format code (placeholder - add black/autopep8 if needed)
@echo "Add code formatting tool like black here"

clean: ## Clean up test artifacts
rm -rf test-results/
rm -rf playwright-report/
rm -rf tests/e2e/screenshots/
rm -rf __pycache__/
find . -name "*.pyc" -delete
find . -name "*.pyo" -delete

run-dev: ## Run development server
pipenv run flask --app api.index run --debug

run-prod: ## Run production server
pipenv run flask --app api.index run

docker-falkordb: ## Start FalkorDB in Docker for testing
docker run -d --name falkordb-test -p 6379:6379 falkordb/falkordb:latest

docker-stop: ## Stop test containers
docker stop falkordb-test || true
docker rm falkordb-test || true
5 changes: 4 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
litellm = {extras = ["bedrock"], version = "~=1.67.0"}
litellm = {extras = ["bedrock"], version = "~=1.74.14"}
falkordb = "~=1.0.10"
flask = "~=3.1.0"
jsonschema = "~=4.23.0"
Expand All @@ -16,6 +16,9 @@ flask-dance = "~=7.1.0"
[dev-packages]
pytest = "~=8.2.0"
pylint = "~=3.3.4"
playwright = "~=1.47.0"
pytest-playwright = "~=0.5.2"
pytest-asyncio = "~=0.24.0"

[requires]
python_version = "3.12"
Loading
Loading