.github/workflows/unit-tests.yml
name: PHPUnit
on:
push:
branches:
- master
- v*
pull_request:
types:
- synchronize
- opened
jobs:
unit-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php-versions: [ '8.1', 'latest' ]
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Validate composer.json
run: composer validate --strict
- name: Remove lock file
run: rm composer.lock
if: matrix.php-versions == '8.0'
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run unit tests
run: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml --testsuite=Unit
- name: Publish code coverage to codeclimate
uses: paambaati/codeclimate-action@v3.2.0
if: matrix.php-versions == 'latest' && matrix.operating-system == 'ubuntu-latest'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPORTER_ID }}
with:
coverageLocations: build/logs/clover.xml:clover