Skip to content

Make use of GHA features #90

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

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
php: ['8.0', '8.1', '8.3', '8.4']
include:
- php: '8.2'
coverage: 'true'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduce a variable for coverage generation.


name: PHP ${{ matrix.php }} tests
steps:
Expand All @@ -19,31 +22,27 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: mbstring, json
coverage: xdebug
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
Copy link
Contributor Author

@szepeviktor szepeviktor Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run all other unit tests faster.
image


- name: Install dependencies
run: composer install

- name: Prepare codeclimate test reporter
if: ${{ matrix.php == '8.2' }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build

- name: Execute tests
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --testdox

- name: Upload the reports to coveralls.io
if: ${{ matrix.php == '8.2' }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: composer update --no-interaction
Copy link
Contributor Author

@szepeviktor szepeviktor Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have a lock file, install emits a warning.


- name: Upload the reports to codeclimate
if: ${{ matrix.php == '8.2' }}
run: sudo ./cc-test-reporter after-build -r $CC_TEST_REPORTER_ID
if: ${{ matrix.coverage }}
env:
XDEBUG_MODE: coverage
CC_TEST_REPORTER_ID: 5e32818628fac9eb11d34e2b35289f88169610cc4a98c6f170c74923342284f1
uses: paambaati/codeclimate-action@v9
with:
coverageCommand: |
./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --testdox

- name: Upload the reports to coveralls.io
if: ${{ matrix.coverage }}
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ env.COVERALLS_REPO_TOKEN }}
flag-name: Unit
allow-empty: false