ci.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. tests:
  42. name: "Unit Tests"
  43. needs: static-code-analysis
  44. runs-on: ${{ matrix.os }}
  45. strategy:
  46. fail-fast: false
  47. matrix:
  48. os:
  49. - ubuntu-latest
  50. - windows-latest
  51. php-version:
  52. - "7.4"
  53. - "8.0"
  54. - "8.1"
  55. - "8.2"
  56. - "8.3"
  57. steps:
  58. - name: "Checkout"
  59. uses: actions/checkout@v3
  60. - name: "Install PHP with extensions"
  61. uses: shivammathur/setup-php@v2
  62. with:
  63. php-version: ${{ matrix.php-version }}
  64. coverage: pcov
  65. tools: pecl
  66. extensions: fileinfo, gd, imagick, json, mbstring
  67. - name: "Install dependencies with composer"
  68. uses: ramsey/composer-install@v2
  69. - name: "Run tests with phpunit"
  70. run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
  71. - name: "Send code coverage report to Codecov.io"
  72. uses: codecov/codecov-action@v3
  73. with:
  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@v3
  87. - name: "Install PHP"
  88. uses: shivammathur/setup-php@v2
  89. with:
  90. php-version: "8.1"
  91. coverage: none
  92. tools: phpDocumentor
  93. extensions: fileinfo, gd, imagick, json, mbstring
  94. - name: "Build API docs"
  95. run: phpdoc --config=phpdoc.xml.dist
  96. - name: "Publish API docs to branch gh-pages"
  97. uses: JamesIves/github-pages-deploy-action@v4
  98. with:
  99. branch: gh-pages
  100. folder: .build/phpdocs
  101. clean: true
  102. build-manual:
  103. name: "Build and publish user manual"
  104. if: github.ref_name == 'main'
  105. runs-on: ubuntu-latest
  106. steps:
  107. - name: "Checkout sources"
  108. uses: actions/checkout@v3
  109. - name: "Install PHP"
  110. uses: shivammathur/setup-php@v2
  111. with:
  112. php-version: "8.1"
  113. coverage: none
  114. - name: "Install Sphinx"
  115. run: pip install sphinx myst-parser sphinx-rtd-theme
  116. - name: "Install dependencies with composer"
  117. uses: ramsey/composer-install@v2
  118. - name: "Build QROptions doc"
  119. run: php docs/qroptions-doc.php
  120. - name: "Build manual"
  121. run: |
  122. cd docs
  123. make html
  124. - name: "Publish user manual to branch readthedocs"
  125. uses: JamesIves/github-pages-deploy-action@v4
  126. with:
  127. branch: readthedocs
  128. folder: .build/sphinx/html
  129. clean: true