tests.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. - main
  7. pull_request:
  8. branches:
  9. - main
  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. env:
  24. PHAN_ALLOW_XDEBUG: 0
  25. PHAN_DISABLE_XDEBUG_WARN: 1
  26. steps:
  27. - name: "Checkout"
  28. uses: actions/checkout@v3
  29. - name: "Install PHP"
  30. uses: shivammathur/setup-php@v2
  31. with:
  32. php-version: ${{ matrix.php-version }}
  33. coverage: none
  34. tools: pecl
  35. extensions: ast, fileinfo, gd, imagick, json, mbstring
  36. - name: "Update dependencies with composer"
  37. uses: ramsey/composer-install@v2
  38. - name: "Run phan"
  39. run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
  40. build-docs:
  41. name: "Build and publish Docs"
  42. if: github.ref_name == 'main'
  43. runs-on: ubuntu-latest
  44. steps:
  45. - name: "Checkout sources"
  46. uses: actions/checkout@v3
  47. - name: "Install PHP"
  48. uses: shivammathur/setup-php@v2
  49. with:
  50. php-version: "8.1"
  51. coverage: none
  52. tools: phpDocumentor
  53. extensions: fileinfo, gd, imagick, json, mbstring
  54. - name: "Build Docs"
  55. run: phpdoc --config=phpdoc.xml.dist
  56. - name: "Publish Docs to gh-pages"
  57. uses: JamesIves/github-pages-deploy-action@v4
  58. with:
  59. branch: gh-pages
  60. folder: docs
  61. clean: true
  62. tests:
  63. name: "Unit Tests"
  64. needs: static-code-analysis
  65. runs-on: ${{ matrix.os }}
  66. strategy:
  67. fail-fast: false
  68. matrix:
  69. os:
  70. - ubuntu-latest
  71. - windows-latest
  72. php-version:
  73. - "7.4"
  74. - "8.0"
  75. - "8.1"
  76. - "8.2"
  77. steps:
  78. - name: "Checkout"
  79. uses: actions/checkout@v3
  80. - name: "Install PHP with extensions"
  81. uses: shivammathur/setup-php@v2
  82. with:
  83. php-version: ${{ matrix.php-version }}
  84. coverage: pcov
  85. tools: pecl
  86. extensions: fileinfo, gd, imagick, json, mbstring
  87. - name: "Install dependencies with composer"
  88. uses: ramsey/composer-install@v2
  89. - name: "Run tests with phpunit"
  90. run: php vendor/bin/phpunit --configuration=phpunit.xml.dist
  91. - name: "Send code coverage report to Codecov.io"
  92. uses: codecov/codecov-action@v3
  93. with:
  94. files: .build/coverage/clover.xml
  95. - name: "Send code coverage report to Codacy"
  96. uses: codacy/codacy-coverage-reporter-action@v1
  97. with:
  98. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  99. coverage-reports: .build/coverage/clover.xml