ci.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. - main
  7. pull_request:
  8. branches:
  9. - main
  10. name: "Continuous Integration"
  11. env:
  12. PHP_EXTENSIONS: ast, 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. - "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. extensions: ${{ env.PHP_EXTENSIONS }}
  35. ini-values: ${{ env.PHP_INI_VALUES }}
  36. coverage: none
  37. tools: pecl
  38. - name: "Install dependencies with composer"
  39. uses: ramsey/composer-install@v3
  40. - name: "Run phan"
  41. run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
  42. tests:
  43. name: "Unit Tests"
  44. needs: static-code-analysis
  45. runs-on: ${{ matrix.os }}
  46. strategy:
  47. fail-fast: false
  48. matrix:
  49. os:
  50. - ubuntu-latest
  51. - windows-latest
  52. php-version:
  53. - "8.2"
  54. - "8.3"
  55. steps:
  56. - name: "Checkout"
  57. uses: actions/checkout@v4
  58. - name: "Install PHP with extensions"
  59. uses: shivammathur/setup-php@v2
  60. with:
  61. php-version: ${{ matrix.php-version }}
  62. extensions: ${{ env.PHP_EXTENSIONS }}
  63. ini-values: ${{ env.PHP_INI_VALUES }}
  64. coverage: pcov
  65. tools: pecl
  66. - name: "Install dependencies with composer"
  67. uses: ramsey/composer-install@v3
  68. - name: "Run tests with PHPUnit"
  69. run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
  70. - name: "Send code coverage report to Codecov.io"
  71. uses: codecov/codecov-action@v4
  72. with:
  73. token: ${{ secrets.CODECOV_TOKEN }}
  74. files: .build/coverage/clover.xml
  75. - name: "Send code coverage report to Codacy"
  76. uses: codacy/codacy-coverage-reporter-action@v1
  77. with:
  78. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  79. coverage-reports: .build/coverage/clover.xml
  80. build-docs:
  81. name: "Build and publish API docs"
  82. if: github.ref_name == 'main'
  83. runs-on: ubuntu-latest
  84. steps:
  85. - name: "Checkout sources"
  86. uses: actions/checkout@v4
  87. - name: "Install PHP"
  88. uses: shivammathur/setup-php@v2
  89. with:
  90. php-version: "8.3"
  91. extensions: ${{ env.PHP_EXTENSIONS }}
  92. ini-values: ${{ env.PHP_INI_VALUES }}
  93. coverage: none
  94. tools: phpDocumentor
  95. - name: "Build API docs"
  96. run: phpdoc --config=phpdoc.xml.dist
  97. - name: "Publish API docs to branch gh-pages"
  98. uses: JamesIves/github-pages-deploy-action@v4
  99. with:
  100. branch: gh-pages
  101. folder: .build/phpdocs
  102. clean: true
  103. build-manual:
  104. name: "Build and publish user manual"
  105. if: github.ref_name == 'main'
  106. runs-on: ubuntu-latest
  107. steps:
  108. - name: "Checkout sources"
  109. uses: actions/checkout@v4
  110. - name: "Install PHP"
  111. uses: shivammathur/setup-php@v2
  112. with:
  113. php-version: "8.3"
  114. extensions: ${{ env.PHP_EXTENSIONS }}
  115. ini-values: ${{ env.PHP_INI_VALUES }}
  116. coverage: none
  117. - name: "Install Sphinx"
  118. run: pip install sphinx myst-parser sphinx-rtd-theme
  119. - name: "Install dependencies with composer"
  120. uses: ramsey/composer-install@v3
  121. - name: "Build QROptions doc"
  122. run: php docs/qroptions-doc.php
  123. - name: "Build manual"
  124. run: |
  125. cd docs
  126. make html
  127. - name: "Publish user manual to branch readthedocs"
  128. uses: JamesIves/github-pages-deploy-action@v4
  129. with:
  130. branch: readthedocs
  131. folder: .build/sphinx/html
  132. clean: true