Skip to content

Commit

Permalink
fixed PHP 8.4 run
Browse files Browse the repository at this point in the history
  • Loading branch information
ogmueller committed Mar 18, 2024
1 parent 78cf199 commit 9757fa4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ jobs:
max-parallel: 2
fail-fast: false
matrix:
php-version: [
"8.1",
"8.2",
"8.3",
# also try a future version
"8.4"
php: [
[ version: "8.1", experimental: false ],
[ version: "8.2", experimental: false ],
[ version: "8.3", experimental: false ],
[ version: "8.4", experimental: true ]
]
composer-param: [
"update --no-progress --prefer-dist --prefer-lowest",
Expand All @@ -42,11 +41,11 @@ jobs:
# PHP 8.4
true,
]
name: "PHP ${{ matrix.php-version }} test"
name: "PHP ${{ matrix.php.version }} test"
steps:
- name: "Check if PHP ${{ matrix.php-version }} is supported"
- name: "Check if PHP ${{ matrix.php.version }} is supported"
if: "matrix.experimental == 'true'"
run: "echo 'PHP ${{ matrix.php-version }} is experimental'"
run: "echo 'PHP ${{ matrix.php.version }} is experimental'"
- name: "checkout project"
uses: "actions/checkout@v4"
with:
Expand All @@ -56,28 +55,28 @@ jobs:
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
php-version: "${{ matrix.php.version }}"
extensions: "bcmath"
tools: "composer:v2"
# needed by PHPUnit code coverage
coverage: "pcov"

- name: "Validate composer.json and composer.lock"
run: "composer validate"
continue-on-error: "${{ matrix.experimental }}"
continue-on-error: "${{ matrix.php.experimental }}"

- name: "Get composer cache directory"
id: "composer-cache"
run: "echo \"dir=$(composer config cache-dir)\" >> $GITHUB_OUTPUT"
continue-on-error: "${{ matrix.experimental }}"
continue-on-error: "${{ matrix.php.experimental }}"

- name: "Cache composer dependencies"
uses: "actions/cache@v4"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"
continue-on-error: "${{ matrix.experimental }}"
continue-on-error: "${{ matrix.php.experimental }}"

- name: "Install dependencies"
run: "composer ${{ matrix.composer-param }}"
Expand All @@ -86,12 +85,12 @@ jobs:
# Run phpunit with code coverage
- name: "PHPUnit Tests"
run: "vendor/bin/phpunit --coverage-clover=coverage.clover"
continue-on-error: "${{ matrix.experimental }}"
continue-on-error: "${{ matrix.php.experimental }}"

# Uploading reports for analysis
- name: "Upload code-coverage to scrutinizer"
run: "vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover"
continue-on-error: "${{ matrix.experimental }}"
continue-on-error: "${{ matrix.php.experimental }}"

- name: "Publish code coverage to Code Climate"
uses: "paambaati/codeclimate-action@v5"
Expand All @@ -101,6 +100,6 @@ jobs:
coverageCommand: "vendor/bin/phpunit --coverage-clover=coverage.clover"
coverageLocations: |
coverage.clover:clover
continue-on-error: "${{ matrix.experimental }}"
continue-on-error: "${{ matrix.php.experimental }}"

# vim: syntax=yaml ts=2 sw=2 et sr softtabstop=2 autoindent
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
[![Type Coverage](https://shepherd.dev/github/teqneers/phpunit-stopwatch/coverage.svg)](https://shepherd.dev/github/teqneers/phpunit-stopwatch)

This project provides a [`composer`](https://getcomposer.org) package and
a [Phar archive](https://www.php.net/manual/en/book.phar.php) with an extension for measering and analysing parts of
a [Phar archive](https://www.php.net/manual/en/book.phar.php) with an extension for measuring and analysing parts of
your code during a test run with [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit).

The extension is compatible with the following versions of `phpunit/phpunit`:

- [`phpunit/phpunit:^10.0.0`](https://github.com/sebastianbergmann/phpunit/tree/10.0.0)
- [`phpunit/phpunit:^10.1.0`](https://github.com/sebastianbergmann/phpunit/tree/10.1.0)
- [`phpunit/phpunit:^11.0.0`](https://github.com/sebastianbergmann/phpunit/tree/11.0.0)

Once you've added some measurement points to your code, the extension will stop watch and count them. The results are
disployed for each test and as a total report at the end of the test run.
displayed for each test and as a total report at the end of the test run.

Here is an example of how the output of a single test class might look like:
Here is an example of how the output of a single test class might look:

```console
Stopwatch for TQ\Tests\Example\SingleTest::testDataCalculation:
Expand Down Expand Up @@ -179,7 +179,7 @@ When you have bootstrapped the extension, you can run your tests as usually. E.g
vendor/bin/phpunit
```

When the extension was used somewhere in your code, it will give you a report:
When the extension is used somewhere in your code, it will give you a report:

## License

Expand Down

0 comments on commit 9757fa4

Please sign in to comment.