ci.yml 3.8 KB

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