tests.yml 3.1 KB

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