ci.yml 2.7 KB

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