Skip to content

Commit 2fbd7d1

Browse files
Athena: Refactor LLM Configuration to YAML-Based System (#92)
Co-authored-by: Aleks Petrov <43567651+alekspetrov9e@users.noreply.github.com>
1 parent e588791 commit 2fbd7d1

121 files changed

Lines changed: 6961 additions & 1766 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/athena_lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
working-directory: athena
3636
run: |
3737
echo "$HOME/.local/bin" >> $GITHUB_PATH
38-
poetry install
38+
poetry install --with dev
3939
poetry run install_all
4040
4141
- name: Run Prospector

.github/workflows/athena_test.yml

Lines changed: 97 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Athena - Tests
2-
32
on:
43
push:
54
branches:
@@ -13,66 +12,103 @@ on:
1312
paths:
1413
- "athena/**"
1514
- ".github/workflows/athena_test.yml"
16-
1715
jobs:
18-
test:
16+
test-and-lint:
1917
runs-on: ubuntu-latest
20-
2118
steps:
22-
- name: Check out code
23-
uses: actions/checkout@v4
24-
25-
- name: Install poetry
26-
run: pipx install poetry
27-
28-
- name: Set up Python
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: '3.11'
32-
cache: 'poetry'
33-
34-
- name: Install dependencies
35-
working-directory: athena
36-
run: |
37-
echo "$HOME/.local/bin" >> $GITHUB_PATH
38-
poetry install
39-
poetry run install_all
40-
41-
- name: Run tests
42-
working-directory: athena
43-
run: poetry run test_all
44-
45-
- name: Upload JUnit Test Results
46-
if: success() || failure()
47-
uses: actions/upload-artifact@v4
48-
with:
49-
name: Athena JUnit Test Results
50-
path: athena/test-results/*.xml
51-
52-
- name: Test Report Summary
53-
if: always()
54-
continue-on-error: true
55-
uses: mikepenz/action-junit-report@v5
56-
id: test-report
57-
with:
58-
report_paths: 'athena/test-results/*.xml'
59-
check_name: "Athena Test Report"
60-
require_tests: true
61-
require_passed_tests: false
62-
detailed_summary: true
63-
include_time_in_summary: true
64-
group_suite: true
65-
66-
- name: Comment test results on PR
67-
if: always() && github.event_name == 'pull_request'
68-
uses: actions/github-script@v7
69-
with:
70-
script: |
71-
const summary = `### Athena Test Results Summary\n\n${{ steps.test-report.outputs.summary }}\n\n#### Failing Tests Summary\n\n${{ steps.test-report.outputs.detailed_summary }}`;
72-
73-
github.rest.issues.createComment({
74-
owner: context.repo.owner,
75-
repo: context.repo.repo,
76-
issue_number: context.payload.pull_request.number,
77-
body: summary
78-
});
19+
- name: Check out code
20+
uses: actions/checkout@v4
21+
- name: Install poetry
22+
run: pipx install poetry
23+
- name: Set up Python 3.11
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.11"
27+
cache: "poetry"
28+
cache-dependency-path: athena/poetry.lock
29+
- name: Configure Poetry for in-project virtual environments
30+
run: poetry config virtualenvs.in-project true
31+
- name: Install athena dependencies
32+
run: poetry -C athena install --with dev
33+
- name: Install all modules
34+
run: |
35+
cd athena
36+
poetry run python scripts/install_modules.py
37+
- name: Run tests
38+
run: |
39+
cd athena
40+
mkdir -p test-results
41+
# Set up Python path like test_modules.py does
42+
export PYTHONPATH="$PWD:$PWD/llm_core"
43+
44+
# Track overall test success
45+
overall_success=true
46+
47+
# Run tests for each module using its own virtual environment
48+
for module in modules/programming/module_programming_llm modules/text/module_text_llm modules/modeling/module_modeling_llm; do
49+
if [ -d "$module/.venv" ]; then
50+
echo "Running tests for $module..."
51+
# Install pytest in the module's environment
52+
$module/.venv/bin/pip install pytest pytest-asyncio
53+
# Run tests using the module's environment
54+
if ! $module/.venv/bin/python -m pytest tests/$module/mock --junitxml=test-results/${module//\//_}_mock.xml; then
55+
echo "Tests failed for $module"
56+
overall_success=false
57+
fi
58+
else
59+
echo "Virtual environment not found for $module, skipping..."
60+
fi
61+
done
62+
63+
# Exit with failure if any tests failed
64+
if [ "$overall_success" = false ]; then
65+
exit 1
66+
fi
67+
- name: Run linting
68+
run: |
69+
cd athena
70+
# Set up Python path like test_modules.py does
71+
export PYTHONPATH="$PWD:$PWD/llm_core"
72+
73+
# Run prospector only on the main athena directory to avoid import errors
74+
poetry run prospector --profile .prospector.yaml athena/
75+
continue-on-error: true
76+
- name: Upload JUnit Test Results
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: junit-results
81+
path: athena/test-results/
82+
report:
83+
runs-on: ubuntu-latest
84+
if: always()
85+
needs: [test-and-lint]
86+
steps:
87+
- name: Check out code
88+
uses: actions/checkout@v4
89+
- name: Download all JUnit results
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: junit-results
93+
path: all-test-results
94+
- name: Test Report Summary
95+
id: test-report
96+
uses: mikepenz/action-junit-report@v5
97+
with:
98+
report_paths: "all-test-results/**/*.xml"
99+
check_name: "Athena Test Report"
100+
require_tests: true
101+
require_passed_tests: false
102+
detailed_summary: true
103+
- name: Comment test results on PR
104+
if: github.event_name == 'pull_request'
105+
uses: actions/github-script@v7
106+
with:
107+
script: |
108+
const summary = `### Athena Test Results Summary\n\n${{ steps.test-report.outputs.summary }}\n\n#### Failing Tests Summary\n\n${{ steps.test-report.outputs.detailed_summary }}`;
109+
github.rest.issues.createComment({
110+
owner: context.repo.owner,
111+
repo: context.repo.repo,
112+
issue_number: context.payload.pull_request.number,
113+
body: summary
114+
});

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,9 @@ Desktop.ini
9898
######################
9999
# Python
100100
######################
101-
**/__pycache__
101+
**/__pycache__
102+
103+
######################
104+
# Test Results
105+
######################
106+
athena/test-results/

athena/.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
"python.linting.enabled": true,
33
"python.linting.prospectorEnabled": true,
44
"python.analysis.typeCheckingMode": "basic",
5+
"python.defaultInterpreterPath": ".venv/bin/python"
56
}

0 commit comments

Comments
 (0)