Skip to content

feat: add CI test-coverage badge #12

feat: add CI test-coverage badge

feat: add CI test-coverage badge #12

Workflow file for this run

name: Tests

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 47, Col: 12): Job 'upload-to-coveralls' depends on unknown job 'tests-with-coverage'.
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.3', '8.4']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: pcntl
tools: composer
- name: Install dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Format code style via Pint
run: vendor/bin/pint --test
- name: Execute unit tests via PHPUnit with coverage
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Export coverage report
if: ${{ matrix.php-version == '8.4' }}
uses: actions/upload-artifact@v4
with:
name: clover.xml
path: build/logs
upload-to-coveralls:
needs: tests-with-coverage
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
- name: Checkout
uses: actions/checkout@v4
- name: Import coverage report
uses: actions/download-artifact@v4
with:
name: clover.xml
path: build/logs
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v --json_path=coveralls-upload.json