tests.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. branches:
  8. - master
  9. tags:
  10. - "**"
  11. name: "Continuous Integration"
  12. jobs:
  13. tests:
  14. name: "Unit Tests"
  15. runs-on: ubuntu-latest
  16. strategy:
  17. matrix:
  18. php-binary:
  19. - php7.4
  20. dependencies:
  21. - lowest
  22. - highest
  23. steps:
  24. - name: "Checkout"
  25. uses: actions/checkout@v1.1.0
  26. - name: "Install lowest dependencies with composer"
  27. if: matrix.dependencies == 'lowest'
  28. run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest
  29. - name: "Install highest dependencies with composer"
  30. if: matrix.dependencies == 'highest'
  31. run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest
  32. - name: "Run unit tests with phpunit"
  33. run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage
  34. code-coverage:
  35. name: "Code Coverage"
  36. runs-on: ubuntu-latest
  37. steps:
  38. - name: "Checkout"
  39. uses: actions/checkout@v1.1.0
  40. - name: "Install locked dependencies with composer"
  41. run: php7.4 $(which composer) install --no-interaction --no-progress --no-suggest
  42. - name: "Dump Xdebug filter with phpunit/phpunit"
  43. run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
  44. - name: "Collect code coverage with Xdebug and phpunit/phpunit"
  45. run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php
  46. - name: "Send code coverage report to Codecov.io"
  47. env:
  48. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  49. run: bash <(curl -s https://codecov.io/bash)