tests.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. name: Tests
  2. on:
  3. push: ~
  4. pull_request: ~
  5. permissions:
  6. contents: read
  7. jobs:
  8. phpcs:
  9. name: PHPCS
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v3
  13. - uses: shivammathur/setup-php@v2
  14. with:
  15. php-version: 7.4
  16. extensions: curl, mbstring, yaml
  17. coverage: none
  18. tools: composer:v2, cs2pr
  19. - run: composer update --no-progress
  20. - run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
  21. phpunit:
  22. name: PHPUnit on ${{ matrix.php }} ${{ matrix.composer-flags }}
  23. runs-on: ubuntu-latest
  24. continue-on-error: ${{ !matrix.stable }}
  25. strategy:
  26. fail-fast: false
  27. matrix:
  28. php: ['7.4', '8.0', '8.1']
  29. stable: [true]
  30. coverage: [true]
  31. composer-flags: ['']
  32. include:
  33. - php: '7.4'
  34. stable: true
  35. coverage: false
  36. composer-flags: '--prefer-lowest'
  37. - php: '8.2'
  38. stable: false
  39. coverage: false
  40. composer-flags: '--ignore-platform-req=php'
  41. steps:
  42. - uses: actions/checkout@v3
  43. with:
  44. fetch-depth: 0
  45. - uses: shivammathur/setup-php@v2
  46. with:
  47. php-version: ${{ matrix.php }}
  48. extensions: curl, mbstring, yaml
  49. coverage: pcov
  50. tools: composer:v2
  51. - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
  52. - run: composer update --no-progress ${{ matrix.composer-flags }}
  53. - run: vendor/bin/phpunit --no-coverage
  54. if: ${{ !matrix.coverage }}
  55. - run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
  56. if: ${{ matrix.coverage }}
  57. - run: php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
  58. if: ${{ matrix.coverage }}
  59. continue-on-error: true
  60. phpstan:
  61. name: PHPStan
  62. runs-on: ubuntu-latest
  63. steps:
  64. - uses: actions/checkout@v3
  65. - uses: shivammathur/setup-php@v2
  66. with:
  67. php-version: 7.4
  68. extensions: curl, mbstring, yaml
  69. coverage: none
  70. tools: composer:v2
  71. - run: composer update --no-progress
  72. - run: vendor/bin/phpstan analyse --no-progress
  73. psalm:
  74. name: Psalm
  75. runs-on: ubuntu-latest
  76. steps:
  77. - uses: actions/checkout@v3
  78. - uses: shivammathur/setup-php@v2
  79. with:
  80. php-version: 7.4
  81. extensions: curl, mbstring, yaml
  82. coverage: none
  83. tools: composer:v2
  84. - run: composer update --no-progress
  85. - run: vendor/bin/psalm --no-progress --stats --threads=$(nproc) --output-format=github --shepherd
  86. docs-lint:
  87. permissions:
  88. contents: read # for actions/checkout to fetch code
  89. statuses: write # for github/super-linter/slim to mark status of each linter run
  90. name: Markdownlint
  91. runs-on: ubuntu-latest
  92. steps:
  93. - uses: actions/checkout@v3
  94. - uses: github/super-linter/slim@v5.0.0
  95. env:
  96. DEFAULT_BRANCH: main
  97. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  98. LINTER_RULES_PATH: '.' # From https://github.com/github/super-linter/pull/859#issuecomment-709625090
  99. VALIDATE_MARKDOWN: true
  100. MARKDOWN_CONFIG_FILE: docs/.markdownlint.yml
  101. FILTER_REGEX_INCLUDE: '/docs/.*'