-
Notifications
You must be signed in to change notification settings - Fork 6
Add GitHub Action (GHA) for unit-tests and code-coverage. #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
62a7a01
4ae6471
b4988b2
984a9a3
901b9a8
ca21b98
29a2370
991ec5d
41c631f
1e0a81a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: PHP Unit Tests | ||
|
|
||
| on: | ||
| - push | ||
| - pull_request | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| php-version: | ||
| - '5.5' | ||
| - '5.6' | ||
| - '7.0' | ||
| - '7.1' | ||
| - '7.2' | ||
| - '7.3' | ||
| - '7.4' | ||
| - '8.0' | ||
| - '8.1' | ||
| - '8.2' | ||
| - '8.3' | ||
| - '8.4' | ||
| - '8.5' | ||
| include: | ||
| - php-version: '7.0' | ||
| allow_failure: true | ||
| - php-version: '7.1' | ||
| allow_failure: true | ||
| - php-version: '7.2' | ||
| allow_failure: true | ||
| - php-version: '7.3' | ||
| allow_failure: true | ||
| - php-version: '7.4' | ||
| allow_failure: true | ||
| - php-version: '8.0' | ||
| allow_failure: true | ||
| - php-version: '8.1' | ||
| allow_failure: true | ||
| - php-version: '8.2' | ||
| allow_failure: true | ||
| - php-version: '8.3' | ||
| allow_failure: true | ||
| - php-version: '8.4' | ||
| allow_failure: true | ||
| - php-version: '8.5' | ||
| allow_failure: true | ||
| continue-on-error: ${{ matrix.allow_failure || false }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| coverage: xdebug | ||
| extensions: gd, json, mbstring | ||
| php-version: ${{ matrix.php-version }} | ||
| - run: composer install --no-interaction --prefer-dist | ||
| - run: vendor/bin/phpunit | ||
| - uses: codecov/codecov-action@v5 | ||
| if: success() | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| - uses: coverallsapp/github-action@v2 | ||
| if: success() | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ARG PHP_VERSION | ||
| FROM php:${PHP_VERSION} | ||
|
|
||
| RUN apk add --no-cache \ | ||
| libpng \ | ||
| libpng-dev \ | ||
| ${PHPIZE_DEPS} \ | ||
| && docker-php-ext-install gd \ | ||
| && pecl install xdebug-2.5.5 \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Docker image fails to build for the PHP versions the project targets The container build hard-codes an ancient coverage tool version ( Version incompatibility between pinned Xdebug and modern PHPThe Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| && docker-php-ext-enable xdebug \ | ||
| && apk del libpng-dev ${PHPIZE_DEPS} | ||
|
|
||
| COPY --from=composer /usr/bin/composer /usr/bin/composer | ||
|
|
||
| ENV XDEBUG_MODE coverage | ||
|
|
||
| WORKDIR /code | ||
|
|
||
| CMD ["php", "./vendor/bin/phpunit"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Test failures on almost every supported PHP version do not fail the CI check
Every modern PHP version from 7.0 through 8.5 is marked as allowed to fail (
allow_failure: trueat.github/workflows/tests.php.unit.yml:26-48), leaving only the two oldest, end-of-life versions able to fail the build, so real breakages on supported versions still show a green check.Impact: A change that breaks the library on any currently-used PHP version (7.0–8.5) will pass CI unnoticed, defeating the purpose of the test matrix.
continue-on-error covers the whole modern matrix
The
includeblock (.github/workflows/tests.php.unit.yml:26-48) setsallow_failure: truefor PHP 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 and 8.5 — i.e. every version except 5.5 and 5.6. Combined withcontinue-on-error: ${{ matrix.allow_failure || false }}(.github/workflows/tests.php.unit.yml:49), only the PHP 5.5 and 5.6 jobs can actually turn the workflow red. Failures in all other jobs are ignored.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.