diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000..4b9b146 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -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 diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..577a667 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,14 @@ + + + + + ./tests + + + + + + ./src + + +