tests.yml 2.4 KB

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