ci.yml 2.7 KB

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