Skip to content

Commit

Permalink
Update to PHPUnit 10 (#46)
Browse files Browse the repository at this point in the history
* update to phpunit 10

* fix phpunit workflow

* update deptrac workflow

* rector workflow update
  • Loading branch information
michalsn authored Sep 18, 2024
1 parent bcca098 commit 7cccd8e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 100 deletions.
55 changes: 2 additions & 53 deletions .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,56 +19,5 @@ on:
- '.github/workflows/deptrac.yml'

jobs:
build:
name: Dependency Tracing
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phive
extensions: intl, json, mbstring, xml
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create Deptrac cache directory
run: mkdir -p build/

- name: Cache Deptrac results
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-deptrac-${{ github.sha }}
restore-keys: ${{ runner.os }}-deptrac-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
- name: Trace dependencies
run: |
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
deptrac analyze --cache-file=build/deptrac.cache
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deptrac:
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
fi
- name: Test with PHPUnit
run: vendor/bin/phpunit --verbose --coverage-text
run: vendor/bin/phpunit --coverage-text
env:
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,22 @@ on:
- 'rector.php'
- '.github/workflows/rector.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: PHP ${{ matrix.php-versions }} Rector Analysis
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
if: (! contains(github.event.head_commit.message, '[ci skip]'))
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2']
php-versions: ['8.1', '8.3']

steps:
- name: Checkout
Expand Down Expand Up @@ -61,6 +68,4 @@ jobs:
fi
- name: Analyze for refactoring
run: |
composer global require --dev rector/rector:^0.19.5
rector process --dry-run --no-progress-bar
run: vendor/bin/rector process --dry-run --no-progress-bar
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ nb-configuration.xml
/results/
/phpunit*.xml
/.phpunit.*.cache

/.phpunit.cache
/.php-cs-fixer.php
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
"autoload": {
"psr-4": {
"CodeIgniter\\Queue\\": "src"
}
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
Expand Down
56 changes: 19 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true">
cacheDirectory=".phpunit.cache"
beStrictAboutCoverageMetadata="true">

<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Commands/Generators</directory>
<directory suffix=".php">./src/Commands/Utils</directory>
<directory suffix=".php">./src/Config</directory>
</exclude>
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="build/phpunit/clover.xml"/>
<html outputDirectory="build/phpunit/html"/>
Expand All @@ -44,27 +32,11 @@
</testsuites>

<extensions>
<extension class="Nexus\PHPUnit\Extension\Tachycardia">
<arguments>
<array>
<element key="timeLimit">
<double>0.50</double>
</element>
<element key="reportable">
<integer>30</integer>
</element>
<element key="precision">
<integer>2</integer>
</element>
<element key="collectBare">
<boolean>true</boolean>
</element>
<element key="tabulate">
<boolean>true</boolean>
</element>
</array>
</arguments>
</extension>
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
<parameter name="time-limit" value="0.50"/>
<parameter name="report-count" value="30"/>
<parameter name="format" value="table"/>
</bootstrap>
</extensions>

<logging>
Expand Down Expand Up @@ -100,4 +72,14 @@
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Commands/Generators</directory>
<directory suffix=".php">./src/Commands/Utils</directory>
<directory suffix=".php">./src/Config</directory>
</exclude>
</source>
</phpunit>
2 changes: 0 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
Expand Down Expand Up @@ -82,7 +81,6 @@
$rectorConfig->skip([
__DIR__ . '/app/Views',

JsonThrowOnErrorRector::class,
StringifyStrNeedlesRector::class,
YieldDataProviderRector::class,

Expand Down

0 comments on commit 7cccd8e

Please sign in to comment.