<!-- .github/pull_request_template.md --> ## Description <!-- Please provide a clear, human-generated description of the changes in this PR. DO NOT use AI-generated descriptions. We want to understand your thought process and reasoning. --> ## Type of Change <!-- Please check the relevant option --> - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Code refactoring - [ ] Performance improvement - [ ] Other (please specify): ## Screenshots/Videos (if applicable) <!-- Add screenshots or videos to help explain your changes --> ## Pre-submission Checklist <!-- Please check all boxes that apply before submitting your PR --> - [ ] **I have tested my changes thoroughly before submitting this PR** - [ ] **This PR contains minimal changes necessary to address the issue/feature** - [ ] My code follows the project's coding standards and style guidelines - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if applicable) - [ ] All new and existing tests pass - [ ] I have searched existing PRs to ensure this change hasn't been submitted already - [ ] I have linked any relevant issues in the description - [ ] My commits have clear and descriptive messages ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
169 lines
No EOL
5.6 KiB
YAML
169 lines
No EOL
5.6 KiB
YAML
name: Weighted Edges Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, dev, weighted_edges ]
|
|
paths:
|
|
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
|
- 'cognee/infrastructure/engine/models/Edge.py'
|
|
- 'cognee/tests/unit/interfaces/graph/test_weighted_edges.py'
|
|
- 'new-examples/demos/weighted_edges_relationships_example.py'
|
|
- '.github/workflows/weighted_edges_tests.yml'
|
|
pull_request:
|
|
branches: [ main, dev ]
|
|
paths:
|
|
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
|
- 'cognee/infrastructure/engine/models/Edge.py'
|
|
- 'cognee/tests/unit/interfaces/graph/test_weighted_edges.py'
|
|
- 'new-examples/demos/weighted_edges_relationships_example.py'
|
|
- '.github/workflows/weighted_edges_tests.yml'
|
|
|
|
env:
|
|
RUNTIME__LOG_LEVEL: ERROR
|
|
ENV: 'dev'
|
|
|
|
jobs:
|
|
test-weighted-edges-functionality:
|
|
name: Test Weighted Edges Core Functionality
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.11', '3.12']
|
|
env:
|
|
LLM_PROVIDER: openai
|
|
LLM_MODEL: gpt-5-mini
|
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cognee Setup
|
|
uses: ./.github/actions/cognee_setup
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Run Weighted Edges Unit Tests
|
|
run: |
|
|
uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v --tb=short
|
|
|
|
- name: Run Standard Graph Tests (Regression)
|
|
run: |
|
|
uv run pytest cognee/tests/unit/interfaces/graph/get_graph_from_model_unit_test.py -v --tb=short
|
|
|
|
test-with-different-databases:
|
|
name: Test Weighted Edges with Different Graph Databases
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
matrix:
|
|
database: ['kuzu', 'neo4j']
|
|
include:
|
|
- database: kuzu
|
|
graph_db_provider: "kuzu"
|
|
- database: neo4j
|
|
graph_db_provider: "neo4j"
|
|
env:
|
|
LLM_PROVIDER: openai
|
|
LLM_MODEL: gpt-5-mini
|
|
LLM_ENDPOINT: https://api.openai.com/v1
|
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
LLM_API_VERSION: "2024-02-01"
|
|
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
|
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
|
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
|
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cognee Setup
|
|
uses: ./.github/actions/cognee_setup
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Setup Neo4j with GDS
|
|
uses: ./.github/actions/setup_neo4j
|
|
id: neo4j
|
|
|
|
- name: Dependencies already installed
|
|
run: echo "Dependencies already installed in setup"
|
|
|
|
- name: Run Weighted Edges Tests
|
|
env:
|
|
GRAPH_DATABASE_PROVIDER: ${{ matrix.graph_db_provider }}
|
|
GRAPH_DATABASE_URL: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-url || '' }}
|
|
GRAPH_DATABASE_USERNAME: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-username || '' }}
|
|
GRAPH_DATABASE_PASSWORD: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-password || '' }}
|
|
run: |
|
|
uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v --tb=short
|
|
|
|
test-examples:
|
|
name: Test Weighted Edges Examples
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
LLM_PROVIDER: openai
|
|
LLM_MODEL: gpt-5-mini
|
|
LLM_ENDPOINT: https://api.openai.com/v1
|
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
LLM_API_VERSION: "2024-02-01"
|
|
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
|
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
|
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
|
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cognee Setup
|
|
uses: ./.github/actions/cognee_setup
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Test Weighted Edges Example
|
|
run: |
|
|
uv run python new-examples/demos/weighted_edges_relationships_example.py
|
|
|
|
- name: Verify Visualization File Created
|
|
run: |
|
|
if [ -f "new-examples/demos/weighted_graph_visualization.html" ]; then
|
|
echo "✅ Visualization file created successfully"
|
|
ls -la new-examples/demos/weighted_graph_visualization.html
|
|
else
|
|
echo "❌ Visualization file not found"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
|
|
code-quality:
|
|
name: Code Quality for Weighted Edges
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cognee Setup
|
|
uses: ./.github/actions/cognee_setup
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Run Linting on Weighted Edges Files
|
|
uses: astral-sh/ruff-action@v2
|
|
with:
|
|
args: "check cognee/modules/graph/utils/get_graph_from_model.py cognee/tests/unit/interfaces/graph/test_weighted_edges.py new-examples/demos/weighted_edges_relationships_example.py"
|
|
|
|
- name: Run Formatting Check on Weighted Edges Files
|
|
uses: astral-sh/ruff-action@v2
|
|
with:
|
|
args: "format --check cognee/modules/graph/utils/get_graph_from_model.py cognee/tests/unit/interfaces/graph/test_weighted_edges.py new-examples/demos/weighted_edges_relationships_example.py"
|
|
|
|
|