|
6 | 6 | pull_request: |
7 | 7 | branches: [ "main" ] |
8 | 8 |
|
9 | | -permissions: |
10 | | - checks: write |
11 | | - contents: read |
12 | | - |
13 | 9 | jobs: |
14 | 10 | laravel-tests: |
15 | 11 | runs-on: ubuntu-latest |
@@ -97,14 +93,36 @@ jobs: |
97 | 93 | run: php artisan config:clear |
98 | 94 |
|
99 | 95 | - name: Execute Tests |
100 | | - run: vendor/bin/pest --log-junit reports/junit.xml |
101 | | - |
102 | | - - name: Test Report |
103 | | - uses: EnricoMi/publish-unit-test-result-action@v2 |
104 | | - if: always() |
105 | | - with: |
106 | | - files: reports/junit.xml |
107 | | - check_name: Pest Tests |
| 96 | + run: | |
| 97 | + vendor/bin/pest --log-junit reports/junit.xml |
| 98 | + echo "### Test Results" >> $GITHUB_STEP_SUMMARY |
| 99 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 100 | + php -r ' |
| 101 | + $xml = simplexml_load_file("reports/junit.xml"); |
| 102 | + $suite = $xml->testsuite; |
| 103 | + $tests = (int)$suite["tests"]; |
| 104 | + $failures = (int)$suite["failures"]; |
| 105 | + $errors = (int)$suite["errors"]; |
| 106 | + $skipped = (int)$suite["skipped"]; |
| 107 | + $passed = $tests - $failures - $errors - $skipped; |
| 108 | + $time = round((float)$suite["time"], 2); |
| 109 | + $icon = ($failures + $errors > 0) ? "❌" : "✅"; |
| 110 | + echo "| Status | Passed | Failed | Errors | Skipped | Time |\n"; |
| 111 | + echo "|--------|--------|--------|--------|---------|------|\n"; |
| 112 | + echo "| $icon | $passed | $failures | $errors | $skipped | {$time}s |\n\n"; |
| 113 | + echo "#### Test Suites\n\n"; |
| 114 | + echo "| Suite | Tests | Passed | Failed | Time |\n"; |
| 115 | + echo "|-------|-------|--------|--------|------|\n"; |
| 116 | + foreach ($suite->testsuite as $child) { |
| 117 | + $name = (string)$child["name"]; |
| 118 | + $t = (int)$child["tests"]; |
| 119 | + $f = (int)$child["failures"] + (int)$child["errors"]; |
| 120 | + $p = $t - $f - (int)$child["skipped"]; |
| 121 | + $dur = round((float)$child["time"], 2); |
| 122 | + $si = $f > 0 ? "❌" : "✅"; |
| 123 | + echo "| $si $name | $t | $p | $f | {$dur}s |\n"; |
| 124 | + } |
| 125 | + ' >> $GITHUB_STEP_SUMMARY |
108 | 126 |
|
109 | 127 | laravel-pint: |
110 | 128 | runs-on: ubuntu-latest |
|
0 commit comments