Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
48 changes: 48 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: PHPUnit

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
name: Test & Upload coverage.xml to Codecov
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Check PHP Version
run: php -v

- name: Install Composer Dependencies
run: composer install --no-interaction --prefer-dist

- name: Run tests via PHPUnit
env:
XDEBUG_MODE: coverage
run: |
vendor/bin/phpunit --coverage-clover=coverage.xml
cat ./coverage.xml

- name: Show coverage.xml
run: cat ./coverage.xml

- name: Upload coverage.xml to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella
verbose: true
env_vars: PHP
14 changes: 14 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage/>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>