ci.yml 2.7 KB

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