forked from Steake/GodelOS
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (133 loc) · 5.6 KB
/
ci.yml
File metadata and controls
147 lines (133 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install \
fastapi uvicorn pydantic pydantic-settings websockets aiofiles PyYAML \
python-multipart psutil networkx numpy scipy jsonschema httpx aiohttp \
nltk \
pytest pytest-cov pytest-asyncio pytest-timeout
- name: Run tests
id: run_tests
run: |
python -m pytest tests/ \
--timeout=30 \
--tb=short \
--cov=backend --cov=godelOS \
--cov-report=term-missing \
--cov-report=xml:coverage.xml \
--junitxml=test-results.xml \
--continue-on-collection-errors \
--ignore=tests/nlu_nlg \
--ignore=tests/common_sense \
--ignore=tests/metacognition \
--ignore=tests/semantic_search \
--ignore=tests/knowledge_extraction \
--ignore=tests/cognitive_transparency \
--ignore=tests/test_distributed_vector_search.py \
--ignore=tests/test_knowledge_pipeline.py \
--ignore=tests/test_dependency_imports.py \
--ignore=tests/frontend \
--ignore=tests/integration \
--ignore=tests/e2e \
--ignore=tests/unit \
--ignore=tests/test_cognitive_architecture_pipeline.py \
--ignore=tests/test_kg_phenomenal_integration.py \
--ignore=tests/test_phenomenal_experience_system.py \
--ignore=tests/e2e_reasoning_test.py \
--ignore=tests/quick_validation.py \
--ignore=tests/run_tests.py \
2>&1 | tee pytest-output.txt
echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
- name: Report results
if: always()
run: |
echo "## 🧪 CI Results — Python ${{ matrix.python-version }}" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
LASTLINE=$(grep -E "passed|failed|error" pytest-output.txt | tail -3 || true)
echo "### Summary" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "${LASTLINE:-no summary}" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
FAILURES=$(grep "^FAILED" pytest-output.txt || true)
if [ -n "$FAILURES" ]; then
echo "### ❌ Failures" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "$FAILURES" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi
ERRS=$(grep "^ERROR" pytest-output.txt | head -20 || true)
if [ -n "$ERRS" ]; then
echo "### ⚠️ Collection Errors" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "$ERRS" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi
if [ -f coverage.xml ]; then
echo "### Coverage" >> "$GITHUB_STEP_SUMMARY"
python -m coverage report --format=markdown 2>/dev/null >> "$GITHUB_STEP_SUMMARY" || true
fi
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-py${{ matrix.python-version }}
path: |
pytest-output.txt
test-results.xml
coverage.xml
retention-days: 7
- name: Comment PR
if: always() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const pyver = '${{ matrix.python-version }}';
const output = fs.existsSync('pytest-output.txt')
? fs.readFileSync('pytest-output.txt', 'utf8') : '';
const lines = output.split('\n');
const summary = lines.filter(l => /passed|failed|error/i.test(l)).slice(-3).join('\n');
const failures = lines.filter(l => l.startsWith('FAILED')).join('\n');
const errors = lines.filter(l => l.startsWith('ERROR') && l.includes('tests/')).slice(0,20).join('\n');
let body = `### 🧪 CI — Python ${pyver}\n\n\`\`\`\n${summary||'no summary'}\n\`\`\`\n`;
if (failures) body += `\n**Failures:**\n\`\`\`\n${failures}\n\`\`\`\n`;
if (errors) body += `\n**Collection errors:**\n\`\`\`\n${errors}\n\`\`\`\n`;
const marker = `CI — Python ${pyver}`;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.data.find(c => c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: existing.id, body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: context.issue.number, body,
});
}