tests.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # https://help.github.com/en/categories/automating-your-workflow-with-github-actions
  2. # https://github.com/localheinz/php-library-template/blob/master/.github/workflows/continuous-integration.yml
  3. # https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml
  4. on:
  5. - pull_request
  6. - push
  7. name: "Continuous Integration"
  8. jobs:
  9. tests:
  10. name: "Unit Tests"
  11. runs-on: ubuntu-latest
  12. strategy:
  13. matrix:
  14. php-binary:
  15. - php7.2
  16. - php7.3
  17. - php7.4
  18. - php8.0
  19. steps:
  20. - name: "Checkout"
  21. uses: actions/checkout@v1.1.0
  22. - name: "Install dependencies with composer"
  23. run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest
  24. - name: "Run unit tests with phpunit"
  25. run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage
  26. code-coverage:
  27. name: "Code Coverage"
  28. runs-on: ubuntu-latest
  29. steps:
  30. - name: "Checkout"
  31. uses: actions/checkout@v1.1.0
  32. - name: "Install locked dependencies with composer"
  33. run: php7.4 $(which composer) install --no-interaction --no-progress --no-suggest
  34. - name: "Dump Xdebug filter with phpunit/phpunit"
  35. run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
  36. - name: "Collect code coverage with Xdebug and phpunit/phpunit"
  37. run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php
  38. - name: "Send code coverage report to Codecov.io"
  39. env:
  40. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  41. run: bash <(curl -s https://codecov.io/bash)