tests.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. steps:
  19. - name: "Checkout"
  20. uses: actions/checkout@v1.1.0
  21. - name: "Install dependencies with composer"
  22. run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest
  23. - name: "Run unit tests with phpunit"
  24. run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage
  25. code-coverage:
  26. name: "Code Coverage"
  27. runs-on: ubuntu-latest
  28. steps:
  29. - name: "Checkout"
  30. uses: actions/checkout@v1.1.0
  31. - name: "Install locked dependencies with composer"
  32. run: php7.4 $(which composer) install --no-interaction --no-progress --no-suggest
  33. - name: "Dump Xdebug filter with phpunit/phpunit"
  34. run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
  35. - name: "Collect code coverage with Xdebug and phpunit/phpunit"
  36. run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php
  37. - name: "Send code coverage report to Codecov.io"
  38. env:
  39. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  40. run: bash <(curl -s https://codecov.io/bash)