ci.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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@v3
  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@v3
  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@v3
  67. with:
  68. files: .build/coverage/clover.xml
  69. - name: "Send code coverage report to Codacy"
  70. uses: codacy/codacy-coverage-reporter-action@v1
  71. with:
  72. project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  73. coverage-reports: .build/coverage/clover.xml
  74. build-docs:
  75. name: "Build and publish API docs"
  76. if: github.ref_name == 'main'
  77. runs-on: ubuntu-latest
  78. steps:
  79. - name: "Checkout sources"
  80. uses: actions/checkout@v3
  81. - name: "Install PHP"
  82. uses: shivammathur/setup-php@v2
  83. with:
  84. php-version: "8.2"
  85. coverage: none
  86. tools: phpDocumentor
  87. extensions: fileinfo, gd, imagick, json, mbstring
  88. - name: "Build API docs"
  89. run: phpdoc --config=phpdoc.xml.dist
  90. - name: "Publish API docs to branch gh-pages"
  91. uses: JamesIves/github-pages-deploy-action@v4
  92. with:
  93. branch: gh-pages
  94. folder: .build/phpdocs
  95. clean: true
  96. build-manual:
  97. name: "Build and publish user manual"
  98. if: github.ref_name == 'main'
  99. runs-on: ubuntu-latest
  100. steps:
  101. - name: "Checkout sources"
  102. uses: actions/checkout@v3
  103. - name: "Install PHP"
  104. uses: shivammathur/setup-php@v2
  105. with:
  106. php-version: "8.2"
  107. coverage: none
  108. - name: "Install Sphinx"
  109. run: pip install sphinx myst-parser sphinx-rtd-theme
  110. - name: "Install dependencies with composer"
  111. uses: ramsey/composer-install@v2
  112. - name: "Build QROptions doc"
  113. run: php docs/qroptions-doc.php
  114. - name: "Build manual"
  115. run: |
  116. cd docs
  117. make html
  118. - name: "Publish user manual to branch readthedocs"
  119. uses: JamesIves/github-pages-deploy-action@v4
  120. with:
  121. branch: readthedocs
  122. folder: .build/sphinx/html
  123. clean: true