alexpts/php-simple-events

View on GitHub
.github/workflows/phpunit.yml

Summary

Maintainability
Test Coverage
# https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions

name: phpunit

on:
  pull_request: {}
  release: {}
  push:
    branches: [ master ]

jobs:
  tests:
    name: unit tests
    runs-on: ubuntu-latest

    strategy:
      matrix:
        php-versions: [ 8.1, 8.2 ]

#    permissions:
#      contents: read
#      pull-requests: write

    steps:
      - uses: actions/checkout@v3
      - uses: php-actions/composer@v6
      - name: phpunit tests ${{ matrix.php-versions }}
        uses: php-actions/phpunit@v3
        with:
          bootstrap: vendor/autoload.php
          configuration: test/phpunit.xml
          php_extensions: pcov
          php_version: ${{ matrix.php-versions }}
          version: 9.5
          #vendored_phpunit_path: vendor/bin/phpunit

      - name: coverage monitor
        uses: slavcodev/coverage-monitor-action@1.6.0
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          coverage_path: test/clover.xml
          comment_footer: false

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }} # require for private repo
          files: test/clover.xml
          name: github-ci
          verbose: true

#      - name: phpunit-coverage-badge
#        uses: timkrase/phpunit-coverage-badge@v1.2.0
#        with:
#          report: test/clover.xml
#          coverage_badge_path: test/coverage.svg
#          push_badge: true
#          repo_token: ${{ secrets.GITHUB_TOKEN }}