main.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. name: main
  2. on: [ push, pull_request ]
  3. jobs:
  4. test:
  5. runs-on: ubuntu-latest
  6. strategy:
  7. matrix:
  8. php-version:
  9. - '5.6'
  10. - '7.0'
  11. - '7.1'
  12. - '7.2'
  13. - '7.3'
  14. - '7.4'
  15. name: PHP ${{ matrix.php-version }}
  16. steps:
  17. - name: Checkout
  18. uses: actions/checkout@v2
  19. - name: Setup PHP, with composer and extensions
  20. uses: shivammathur/setup-php@v2
  21. with:
  22. php-version: ${{ matrix.php-version }}
  23. extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
  24. coverage: none
  25. - name: Get composer cache directory
  26. id: composer-cache
  27. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  28. - name: Cache composer dependencies
  29. uses: actions/cache@v2
  30. with:
  31. path: ${{ steps.composer-cache.outputs.dir }}
  32. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  33. restore-keys: ${{ runner.os }}-composer-
  34. - name: Install dependencies
  35. run: composer install --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }}
  36. - name: Setup problem matchers for PHP
  37. run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
  38. - name: Setup problem matchers for PHPUnit
  39. run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
  40. - name: Test with PHPUnit
  41. run: ./vendor/bin/phpunit
  42. phpcs:
  43. runs-on: ubuntu-latest
  44. steps:
  45. - name: Checkout
  46. uses: actions/checkout@v2
  47. - name: Setup PHP, with composer and extensions
  48. uses: shivammathur/setup-php@v2
  49. with:
  50. php-version: 7.4
  51. extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
  52. coverage: none
  53. tools: cs2pr
  54. - name: Get composer cache directory
  55. id: composer-cache
  56. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  57. - name: Cache composer dependencies
  58. uses: actions/cache@v2
  59. with:
  60. path: ${{ steps.composer-cache.outputs.dir }}
  61. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  62. restore-keys: ${{ runner.os }}-composer-
  63. - name: Install dependencies
  64. run: composer install --no-progress --prefer-dist --optimize-autoloader
  65. - name: Code style with PHP_CodeSniffer
  66. run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr --graceful-warnings --colorize
  67. coverage:
  68. runs-on: ubuntu-latest
  69. steps:
  70. - name: Checkout
  71. uses: actions/checkout@v2
  72. - name: Setup PHP, with composer and extensions
  73. uses: shivammathur/setup-php@v2
  74. with:
  75. php-version: 7.4
  76. extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
  77. coverage: pcov
  78. - name: Get composer cache directory
  79. id: composer-cache
  80. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  81. - name: Cache composer dependencies
  82. uses: actions/cache@v2
  83. with:
  84. path: ${{ steps.composer-cache.outputs.dir }}
  85. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  86. restore-keys: ${{ runner.os }}-composer-
  87. - name: Install dependencies
  88. run: composer install --no-progress --prefer-dist --optimize-autoloader
  89. - name: Coverage
  90. run: |
  91. ./vendor/bin/phpunit --coverage-text