@@ -18,51 +18,17 @@ jobs:
18
18
19
19
- name : Run MATLAB Tests
20
20
run : |
21
- matlab -batch "run('cobratoolbox/initCobraToolbox.m'); diary('test_results.txt'); run('cobratoolbox/test/testAll.m'); diary off;"
21
+ matlab -batch "run('cobratoolbox/initCobraToolbox.m'); diary('cobratoolbox/ test_results.txt'); run('cobratoolbox/test/testAll.m'); diary off;"
22
22
23
23
- name : Upload Test Report
24
24
uses : actions/upload-artifact@v4
25
25
with :
26
26
name : test-report
27
- path : |
28
- test_results.txt
29
- cobratoolbox/CodeCovTestResults.xml
27
+ path : cobratoolbox/test_results.txt # Correct path
30
28
31
- # Parse Test Results and Comment on PR using regex
32
- - name : Parse Test Results and Comment on PR
33
- uses : actions/github-script@v5
34
- env :
35
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
29
+ - name : Upload Coverage to Codecov
30
+ if : always()
31
+ uses : codecov/codecov-action@v3
36
32
with :
37
- script : |
38
- const fs = require('fs');
39
- const xml = fs.readFileSync('cobratoolbox/CodeCovTestResults.xml', 'utf8');
40
-
41
- // Extract data using regex
42
- const passedRegex = /tests="(\d+)" failures="(\d+)" errors="(\d+)" skipped="(\d+)"/;
43
- const matches = passedRegex.exec(xml);
44
- const totalTests = matches[1];
45
- const failures = matches[2];
46
- const errors = matches[3];
47
- const skipped = matches[4];
48
-
49
- let summary = `Test Results: Passed: ${totalTests - failures - skipped}, Failed: ${failures}, Errors: ${errors}, Skipped: ${skipped}`;
50
-
51
- // Find failed tests
52
- const failedTestsRegex = /<testcase classname="[^"]*" name="([^"]+)"[^>]*>\s*<(error|failure)[^>]*>([^<]*)<\/(error|failure)>/g;
53
- let failedTestDetails = '';
54
- let match;
55
- while ((match = failedTestsRegex.exec(xml)) !== null) {
56
- failedTestDetails += `\n* ${match[1]}: ${match[3]}`;
57
- }
58
-
59
- if (failedTestDetails.length > 0) {
60
- summary += `\n\nFailed Tests:${failedTestDetails}`;
61
- }
62
-
63
- github.rest.issues.createComment({
64
- issue_number: context.issue.number,
65
- owner: context.repo.owner,
66
- repo: context.repo.repo,
67
- body: summary
68
- });
33
+ files : cobratoolbox/CodeCovTestResults.xml # Correct path
34
+
0 commit comments