Skip to content

Commit 88ad708

Browse files
author
farhadzand
committed
add log
1 parent b0544a7 commit 88ad708

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

.github/workflows/code-quality.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,47 @@ name: code-quality
33
on:
44
push:
55
branches:
6-
- main
6+
- '*'
77
pull_request:
88
branches:
9-
- main
9+
- '*'
1010

1111
jobs:
12+
phpstan:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
env:
16+
COMPOSER_NO_INTERACTION: 1
17+
strategy:
18+
matrix:
19+
php: [8.2]
20+
laravel: [12.*]
21+
include:
22+
- laravel: 12.*
23+
testbench: 10.*
24+
25+
name: PHPStan
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php }}
35+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
36+
coverage: none
37+
38+
- name: Install dependencies
39+
run: |
40+
composer require "illuminate/console:${{ matrix.laravel }}" "illuminate/database:${{ matrix.laravel }}" "illuminate/filesystem:${{ matrix.laravel }}" --no-update
41+
composer require "orchestra/testbench:${{ matrix.testbench }}" --dev --no-update
42+
composer update --prefer-dist --no-suggest
43+
44+
- name: Execute PHPStan
45+
run: vendor/bin/phpstan analyse
46+
1247
test-and-analyze:
1348
name: Test & Analyze
1449
runs-on: ubuntu-latest

.scrutinizer.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ build:
22
environment:
33
php:
44
version: 8.2
5+
ini:
6+
xdebug.mode: coverage
57

68
nodes:
79
analysis:
@@ -10,9 +12,13 @@ build:
1012
- php-scrutinizer-run
1113

1214
coverage:
15+
environment:
16+
php:
17+
ini:
18+
xdebug.mode: coverage
1319
tests:
1420
override:
15-
- command: vendor/bin/phpunit --coverage-clover=coverage.clover
21+
- command: chmod +x ./run-coverage.sh && ./run-coverage.sh
1622
coverage:
1723
file: coverage.clover
1824
format: clover

run-coverage.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Ensure Xdebug is enabled for coverage
4+
export XDEBUG_MODE=coverage
5+
6+
# Run PHPUnit with coverage options
7+
php -dxdebug.mode=coverage vendor/bin/phpunit --coverage-clover=coverage.clover
8+
9+
# Check if coverage file was generated
10+
if [ -f "coverage.clover" ]; then
11+
echo "Coverage file generated successfully"
12+
13+
# If ocular is available, upload to Scrutinizer
14+
if [ -f "ocular.phar" ]; then
15+
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
16+
else
17+
echo "Downloading ocular.phar..."
18+
wget https://scrutinizer-ci.com/ocular.phar
19+
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
20+
fi
21+
else
22+
echo "Failed to generate coverage file"
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)