Skip to content

Commit c7312e4

Browse files
committed
ci: Add GitHub Actions and test suite
- Add CI workflow for Python 3.11 and 3.12 - Create basic test suite - Add example scripts
1 parent d230219 commit c7312e4

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [3.11, 3.12]
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Install dependencies
19+
run: |
20+
pip install -r requirements.txt
21+
pip install pytest
22+
- name: Run tests
23+
run: pytest tests/ -v

examples/analyze_django.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# Example: Analyze Django repository
3+
4+
git clone https://github.com/django/django.git /tmp/django
5+
cd /tmp/django
6+
7+
python3 -m venv venv
8+
source venv/bin/activate
9+
pip install -r /path/to/devmemory/requirements.txt
10+
11+
python /path/to/devmemory/src/cli.py analyze --days 30
12+
python /path/to/devmemory/src/cli.py stats
13+
python /path/to/devmemory/src/cli.py export --output django_decisions.md

tests/test_analyzer.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
from src.analyzer.decision_detector import DecisionPatternAnalyzer
3+
from datetime import datetime
4+
5+
def test_dependency_detection():
6+
analyzer = DecisionPatternAnalyzer()
7+
decision = analyzer.analyze_commit(
8+
commit_message="Add Redis for caching",
9+
files_changed=['requirements.txt'],
10+
commit_hash='abc123',
11+
author='Test',
12+
date=datetime.now()
13+
)
14+
assert decision is not None
15+
assert decision.type == 'dependency_added'
16+
assert decision.confidence > 0.5
17+
18+
def test_refactor_detection():
19+
analyzer = DecisionPatternAnalyzer()
20+
decision = analyzer.analyze_commit(
21+
commit_message="Refactor authentication system",
22+
files_changed=['auth.py'],
23+
commit_hash='def456',
24+
author='Test',
25+
date=datetime.now()
26+
)
27+
assert decision is not None
28+
assert decision.type == 'architecture_change'

0 commit comments

Comments
 (0)