Skip to content

Commit c19ae85

Browse files
authored
Update php-cs-fixer, simplify tests, remove Scrutinizer (#107)
1 parent c9b8198 commit c19ae85

5 files changed

Lines changed: 116 additions & 313 deletions

File tree

.github/workflows/tests.yml

Lines changed: 26 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
extensions: opcache
2929
-
3030
name: Checkout
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
3232
-
3333
name: Check syntax
3434
uses: mlocati/check-php-syntax@v1
@@ -45,26 +45,23 @@ jobs:
4545
name: Setup PHP
4646
uses: shivammathur/setup-php@v2
4747
with:
48-
php-version: "7.2"
48+
php-version: "8.4"
4949
extensions: mbstring, openssl, zip
50-
tools: composer:v2, php-cs-fixer:v2
50+
tools: composer:v2, php-cs-fixer:v3
5151
coverage: none
5252
-
5353
name: Checkout
54-
uses: actions/checkout@v4
54+
uses: actions/checkout@v5
5555
with:
5656
fetch-depth: 1
5757
-
5858
name: Check PHP coding style
59-
run: |
60-
php-cs-fixer fix --dry-run --config=./.php_cs.dist --using-cache=no --diff --diff-format=udiff --show-progress=dots --verbose --no-interaction --ansi
59+
run: php-cs-fixer fix --dry-run --using-cache=no --diff --format=@auto --show-progress=dots --verbose --no-interaction --ansi
6160
phpunit:
62-
name: Run PHPUnit tests
61+
name: PHPUnit (${{ matrix.php-version }} ${{ matrix.os }})
6362
needs:
6463
- php-syntax
6564
- php-coding-style
66-
env:
67-
CODE_COVERAGE_TOOL: none
6865
strategy:
6966
fail-fast: false
7067
matrix:
@@ -84,68 +81,52 @@ jobs:
8481
- "8.1"
8582
- "8.2"
8683
- "8.3"
87-
- "8.4"
84+
php-coverage:
85+
- none
86+
composer-options:
87+
- ""
8888
include:
89+
-
90+
os: ubuntu-latest
91+
php-version: "8.4"
92+
php-coverage: xdebug
93+
composer-options: --coverage-clover coverage-clover.xml
8994
-
9095
os: windows-latest
9196
php-version: "5.5"
97+
php-coverage: none
98+
composer-options: ""
9299
-
93100
os: windows-latest
94101
php-version: "7.4"
102+
php-coverage: none
103+
composer-options: ""
95104
runs-on: ${{ matrix.os }}
96105
steps:
97-
-
98-
name: Set code coverage
99-
if: startsWith(matrix.os, 'ubuntu') && matrix.php-version == '7.2' && github.repository_owner == 'mlocati'
100-
run: |
101-
echo "CODE_COVERAGE_TOOL=xdebug" >> $GITHUB_ENV
102106
-
103107
name: Setup PHP
104108
uses: shivammathur/setup-php@v2
105109
with:
106110
php-version: ${{ matrix.php-version }}
107111
tools: composer:v2
108112
extensions: pdo_sqlite
109-
coverage: ${{ env.CODE_COVERAGE_TOOL }}
113+
coverage: ${{ matrix.php-coverage }}
110114
-
111115
name: Checkout
112116
uses: actions/checkout@v4
113117
-
114118
name: Install Composer dependencies
115-
if: matrix.php-version != '8.2'
116119
run: composer --ansi --no-interaction --no-progress --optimize-autoloader update
117120
-
118-
name: Install Composer dependencies (ignore platform reqs)
119-
if: matrix.php-version == '8.2'
120-
run: composer --ansi --no-interaction --no-progress --optimize-autoloader --ignore-platform-reqs update
121-
-
122-
name: Run PHPUnit (without code coverage)
123-
if: env.CODE_COVERAGE_TOOL == 'none'
124-
run: composer --ansi --no-interaction run-script test
125-
-
126-
name: Run PHPUnit (with code coverage)
127-
if: env.CODE_COVERAGE_TOOL != 'none'
128-
run: composer --ansi --no-interaction run-script test -- --coverage-clover coverage-clover.xml
121+
name: Run PHPUnit
122+
run: composer --ansi --no-interaction run-script test -- ${{ matrix.composer-options }}
129123
-
130124
name: Download Coveralls
131-
if: env.CODE_COVERAGE_TOOL != 'none'
132-
run: curl -sSLf -o php-coveralls.phar https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.3/php-coveralls.phar
125+
if: matrix.php-coverage && matrix.php-coverage != 'none'
126+
run: curl -sSLf -o php-coveralls.phar https://github.com/php-coveralls/php-coveralls/releases/download/v2.8.0/php-coveralls.phar
133127
-
134128
name: Upload Coveralls data
135-
if: env.CODE_COVERAGE_TOOL != 'none'
129+
if: matrix.php-coverage && matrix.php-coverage != 'none'
136130
env:
137131
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138-
run: >
139-
php php-coveralls.phar
140-
--coverage_clover=coverage-clover.xml --json_path=coveralls-upload.json --ansi --no-interaction -vvv
141-
-
142-
name: Download Scrutinizer
143-
if: env.CODE_COVERAGE_TOOL != 'none'
144-
run: curl -sSLf -o ocular.phar https://scrutinizer-ci.com/ocular.phar
145-
-
146-
name: Upload Scrutinizer data
147-
if: env.CODE_COVERAGE_TOOL != 'none'
148-
run: >
149-
php ocular.phar code-coverage:upload
150-
--format=php-clover --ansi --no-interaction
151-
coverage-clover.xml
132+
run: php php-coveralls.phar --coverage_clover=coverage-clover.xml --json_path=coveralls-upload.json --ansi --no-interaction -vvv

0 commit comments

Comments
 (0)