Skip to content

Commit

Permalink
Update codecov.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
farid-zare authored Feb 3, 2025
1 parent b112525 commit 48546e8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: test-report
path: test_results.txt
path: |
test_results.txt
cobratoolbox/CodeCovTestResults.xml
# Parse Test Results and Comment on PR using regex
- name: Parse Test Results and Comment on PR
Expand All @@ -34,7 +36,7 @@ jobs:
with:
script: |
const fs = require('fs');
const xml = fs.readFileSync('CodeCovTestResults.xml', 'utf8');
const xml = fs.readFileSync('cobratoolbox/CodeCovTestResults.xml', 'utf8');
// Extract data using regex
const passedRegex = /tests="(\d+)" failures="(\d+)" errors="(\d+)" skipped="(\d+)"/;
Expand All @@ -47,11 +49,11 @@ jobs:
let summary = `Test Results: Passed: ${totalTests - failures - skipped}, Failed: ${failures}, Errors: ${errors}, Skipped: ${skipped}`;
// Find failed tests
const failedTestsRegex = /<testcase classname="[^"]*" name="([^"]+)"[^>]*>\s*<error[^>]*>([^<]*)<\/error>/g;
const failedTestsRegex = /<testcase classname="[^"]*" name="([^"]+)"[^>]*>\s*<(error|failure)[^>]*>([^<]*)<\/(error|failure)>/g;
let failedTestDetails = '';
let match;
while ((match = failedTestsRegex.exec(xml)) !== null) {
failedTestDetails += `\n* ${match[1]}: ${match[2]}`;
failedTestDetails += `\n* ${match[1]}: ${match[3]}`;
}
if (failedTestDetails.length > 0) {
Expand Down

0 comments on commit 48546e8

Please sign in to comment.