ci.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. - name: "Run PHP_CodeSniffer"
  45. run: php vendor/bin/phpcs
  46. tests:
  47. name: "Unit Tests"
  48. needs: static-code-analysis
  49. runs-on: ${{ matrix.os }}
  50. strategy:
  51. fail-fast: false
  52. matrix:
  53. os:
  54. - ubuntu-latest
  55. - windows-latest
  56. php-version:
  57. - "7.4"
  58. - "8.0"
  59. - "8.1"
  60. - "8.2"
  61. - "8.3"
  62. - "8.4"
  63. steps:
  64. - name: "Checkout"
  65. uses: actions/checkout@v4
  66. - name: "Install PHP with extensions"
  67. uses: shivammathur/setup-php@v2
  68. with:
  69. php-version: ${{ matrix.php-version }}
  70. extensions: ${{ env.PHP_EXTENSIONS }}
  71. ini-values: ${{ env.PHP_INI_VALUES }}
  72. coverage: pcov
  73. tools: pecl
  74. - name: "Install dependencies with composer"
  75. uses: ramsey/composer-install@v3
  76. - name: "Run tests with PHPUnit"
  77. run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
  78. - name: "Send code coverage report to Codecov.io"
  79. uses: codecov/codecov-action@v4
  80. with:
  81. token: ${{ secrets.CODECOV_TOKEN }}
  82. files: .build/coverage/clover.xml
  83. - name: "Send code coverage report to Codacy"
  84. uses: codacy/codacy-coverage-reporter-action@v1
  85. with:
  86. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  87. coverage-reports: .build/coverage/clover.xml