88 paths :
99 - ' src/backend-api/**/*.py'
1010 - ' src/backend-api/pyproject.toml'
11+ - ' src/backend-api/uv.lock'
1112 - ' src/backend-api/pytest.ini'
13+ - ' src/processor/**/*.py'
14+ - ' src/processor/pyproject.toml'
15+ - ' src/processor/uv.lock'
1216 - ' .github/workflows/test.yml'
1317 pull_request :
1418 types :
2226 paths :
2327 - ' src/backend-api/**/*.py'
2428 - ' src/backend-api/pyproject.toml'
29+ - ' src/backend-api/uv.lock'
2530 - ' src/backend-api/pytest.ini'
31+ - ' src/processor/**/*.py'
32+ - ' src/processor/pyproject.toml'
33+ - ' src/processor/uv.lock'
2634 - ' .github/workflows/test.yml'
2735
2836permissions :
@@ -36,10 +44,10 @@ jobs:
3644
3745 steps :
3846 - name : Checkout code
39- uses : actions/checkout@v5
47+ uses : actions/checkout@v4
4048
4149 - name : Set up Python
42- uses : actions/setup-python@v6
50+ uses : actions/setup-python@v5
4351 with :
4452 python-version : " 3.12"
4553
4856 python -m pip install --upgrade pip
4957 cd src/backend-api
5058 pip install -e .
51- pip install pytest pytest-cov
59+ pip install pytest pytest-cov pytest-asyncio
5260
5361 - name : Check if Backend Test Files Exist
5462 id : check_backend_tests
7179 --cov=src/app \
7280 --cov-report=term-missing \
7381 --cov-report=xml:reports/coverage.xml \
82+ --cov-fail-under=82 \
7483 --junitxml=pytest.xml \
7584 -v
7685
86+ - name : Prefix coverage XML filenames with repo-root path
87+ if : env.skip_backend_tests == 'false'
88+ run : |
89+ python <<'PY'
90+ import xml.etree.ElementTree as ET
91+ path = "src/backend-api/reports/coverage.xml"
92+ prefix = "src/backend-api/src/app/"
93+ tree = ET.parse(path)
94+ root = tree.getroot()
95+ for cls in root.iter("class"):
96+ fname = cls.attrib.get("filename", "")
97+ if fname and not fname.startswith(prefix):
98+ cls.attrib["filename"] = prefix + fname
99+ tree.write(path, xml_declaration=True, encoding="utf-8")
100+ PY
101+
77102 - name : Pytest Coverage Comment
78103 if : |
79104 always() &&
@@ -90,3 +115,80 @@ jobs:
90115 if : env.skip_backend_tests == 'true'
91116 run : |
92117 echo "Skipping backend tests because no test files were found."
118+
119+ processor_tests :
120+ runs-on : ubuntu-latest
121+
122+ steps :
123+ - name : Checkout code
124+ uses : actions/checkout@v4
125+
126+ - name : Set up Python
127+ uses : actions/setup-python@v5
128+ with :
129+ python-version : " 3.12"
130+
131+ - name : Install Processor Dependencies
132+ run : |
133+ python -m pip install --upgrade pip
134+ cd src/processor
135+ pip install -e .
136+ pip install pytest pytest-cov pytest-asyncio
137+
138+ - name : Check if Processor Test Files Exist
139+ id : check_processor_tests
140+ run : |
141+ if [ -z "$(find src/processor/src/tests -type f -name 'test_*.py' 2>/dev/null)" ]; then
142+ echo "No processor test files found, skipping processor tests."
143+ echo "skip_processor_tests=true" >> $GITHUB_ENV
144+ else
145+ echo "Processor test files found, running tests."
146+ echo "skip_processor_tests=false" >> $GITHUB_ENV
147+ fi
148+
149+ - name : Run Processor Tests with Coverage
150+ if : env.skip_processor_tests == 'false'
151+ run : |
152+ cd src/processor
153+ pytest src/tests \
154+ --cov=src \
155+ --cov-report=term-missing \
156+ --cov-report=xml:reports/coverage.xml \
157+ --cov-fail-under=82 \
158+ --junitxml=pytest.xml \
159+ -v
160+
161+ - name : Prefix coverage XML filenames with repo-root path
162+ if : env.skip_processor_tests == 'false'
163+ run : |
164+ python <<'PY'
165+ import xml.etree.ElementTree as ET
166+ path = "src/processor/reports/coverage.xml"
167+ prefix = "src/processor/src/"
168+ tree = ET.parse(path)
169+ root = tree.getroot()
170+ for cls in root.iter("class"):
171+ fname = cls.attrib.get("filename", "")
172+ if fname and not fname.startswith(prefix):
173+ cls.attrib["filename"] = prefix + fname
174+ tree.write(path, xml_declaration=True, encoding="utf-8")
175+ PY
176+
177+ - name : Pytest Coverage Comment (Processor)
178+ if : |
179+ always() &&
180+ github.event_name == 'pull_request' &&
181+ github.event.pull_request.head.repo.fork == false &&
182+ env.skip_processor_tests == 'false'
183+ uses : MishaKav/pytest-coverage-comment@26f986d2599c288bb62f623d29c2da98609e9cd4 # v1.6.0
184+ with :
185+ pytest-xml-coverage-path : src/processor/reports/coverage.xml
186+ junitxml-path : src/processor/pytest.xml
187+ title : Processor Coverage Report
188+ unique-id-for-comment : processor
189+ report-only-changed-files : true
190+
191+ - name : Skip Processor Tests
192+ if : env.skip_processor_tests == 'true'
193+ run : |
194+ echo "Skipping processor tests because no test files were found."
0 commit comments