ci.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
  2. # https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yaml
  3. on:
  4. push:
  5. branches:
  6. - v5.0.x
  7. pull_request:
  8. branches:
  9. - v5.0.x
  10. name: "Continuous Integration"
  11. env:
  12. PHP_EXTENSIONS: fileinfo, gd, imagick, json, mbstring
  13. PHP_INI_VALUES: memory_limit=-1, error_reporting=-1, display_errors=On
  14. jobs:
  15. static-code-analysis:
  16. name: "Static Code Analysis"
  17. runs-on: ubuntu-latest
  18. strategy:
  19. fail-fast: true
  20. matrix:
  21. php-version:
  22. - "7.4"
  23. - "8.0"
  24. - "8.1"
  25. - "8.2"
  26. - "8.3"
  27. env:
  28. PHAN_ALLOW_XDEBUG: 0
  29. PHAN_DISABLE_XDEBUG_WARN: 1
  30. steps:
  31. - name: "Checkout"
  32. uses: actions/checkout@v4
  33. - name: "Install PHP"
  34. uses: shivammathur/setup-php@v2
  35. with:
  36. php-version: ${{ matrix.php-version }}
  37. extensions: ast, ${{ env.PHP_EXTENSIONS }}
  38. ini-values: ${{ env.PHP_INI_VALUES }}
  39. coverage: none
  40. - name: "Install dependencies with composer"
  41. uses: ramsey/composer-install@v3
  42. - name: "Run phan"
  43. run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
  44. tests:
  45. name: "Unit Tests"
  46. needs: static-code-analysis
  47. runs-on: ${{ matrix.os }}
  48. strategy:
  49. fail-fast: false
  50. matrix:
  51. os:
  52. - ubuntu-latest
  53. - windows-latest
  54. php-version:
  55. - "7.4"
  56. - "8.0"
  57. - "8.1"
  58. - "8.2"
  59. - "8.3"
  60. steps:
  61. - name: "Checkout"
  62. uses: actions/checkout@v4
  63. - name: "Install PHP with extensions"
  64. uses: shivammathur/setup-php@v2
  65. with:
  66. php-version: ${{ matrix.php-version }}
  67. extensions: ${{ env.PHP_EXTENSIONS }}
  68. ini-values: ${{ env.PHP_INI_VALUES }}
  69. coverage: pcov
  70. tools: pecl
  71. - name: "Install dependencies with composer"
  72. uses: ramsey/composer-install@v3
  73. - name: "Run tests with PHPUnit"
  74. run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
  75. - name: "Send code coverage report to Codecov.io"
  76. uses: codecov/codecov-action@v4
  77. with:
  78. token: ${{ secrets.CODECOV_TOKEN }}
  79. files: .build/coverage/clover.xml
  80. - name: "Send code coverage report to Codacy"
  81. uses: codacy/codacy-coverage-reporter-action@v1
  82. with:
  83. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  84. coverage-reports: .build/coverage/clover.xml