Skip to content

Add code coverage

Add code coverage #11

Workflow file for this run

name: automated-testing
on:
pull_request:
push:
branches:
- master
jobs:
run:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
dependencies: [ lowest, stable, beta ]
experimental: [ false ]
include:
- description: 'stable dependencies'
dependencies: stable
- description: 'lowest dependencies'
dependencies: lowest
- description: 'beta/RC dependencies'
dependencies: beta
experimental: true
- description: 'PHP upcoming'
php: 8.3
experimental: true
- description: 'PHP nightly'
php: 8.4
experimental: true
name: PHP ${{ matrix.php }} ${{ matrix.description }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Allow beta dependencies
run: composer config minimum-stability beta
if: matrix.dependencies == 'beta'
- name: Install dependencies
run: composer update ${{ (matrix.dependencies == 'lowest') && '--prefer-lowest --prefer-stable' || ''}}
- name: Run PHPStan static analysis
run: vendor/bin/phpstan
if: ${{ matrix.dependencies == 'stable' && !matrix.experimental }}
- name: Check for dangerous and broken dependencies
run: composer audit
if: ${{ matrix.dependencies == 'stable' && !matrix.experimental }}
- name: Run automated tests
run: vendor/bin/phpunit --coverage-text --coverage-cobertura build/cobertura.xml
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: build/cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '80 90'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Run infection tests
run: vendor/bin/infection --threads=max
if: ${{ matrix.dependencies == 'stable' && !matrix.experimental }}