Skip to content

Commit 194de1c

Browse files
committed
Fix PDO SSL deprecation on PHP 8.5, use step summary for test report
1 parent 88b3d1d commit 194de1c

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

.github/workflows/laravel.yml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
pull_request:
77
branches: [ "main" ]
88

9-
permissions:
10-
checks: write
11-
contents: read
12-
139
jobs:
1410
laravel-tests:
1511
runs-on: ubuntu-latest
@@ -97,14 +93,36 @@ jobs:
9793
run: php artisan config:clear
9894

9995
- 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
108126
109127
laravel-pint:
110128
runs-on: ubuntu-latest

config/database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
'prefix_indexes' => true,
5959
'strict' => true,
6060
'engine' => null,
61-
'options' => extension_loaded('pdo_mysql') ? array_filter([
61+
'options' => extension_loaded('pdo_mysql') && env('MYSQL_ATTR_SSL_CA') ? [
6262
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
63-
]) : [],
63+
] : [],
6464
],
6565

6666
'pgsql' => [

0 commit comments

Comments
 (0)