ci.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: continuous-integration
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - release/*
  7. pull_request:
  8. jobs:
  9. unit-testing:
  10. name: PHPUnit (PHP ${{ matrix.php-versions }})
  11. runs-on: ubuntu-latest
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
  16. coverage: ['xdebug']
  17. code-style: ['yes']
  18. code-analysis: ['no']
  19. include:
  20. - php-versions: '7.1'
  21. code-style: 'yes'
  22. code-analysis: 'yes'
  23. - php-versions: '8.4'
  24. code-style: 'yes'
  25. code-analysis: 'yes'
  26. steps:
  27. - name: Checkout
  28. uses: actions/checkout@v4
  29. - name: Setup PHP, with composer and extensions
  30. uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
  31. with:
  32. php-version: ${{ matrix.php-versions }}
  33. extensions: ctype, curl, mbstring, xdebug
  34. coverage: ${{ matrix.coverage }}
  35. tools: composer
  36. - name: Get composer cache directory
  37. id: composer-cache
  38. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  39. - name: Cache composer dependencies
  40. uses: actions/cache@v4
  41. with:
  42. path: ${{ steps.composer-cache.outputs.dir }}
  43. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
  44. restore-keys: ${{ runner.os }}-composer-
  45. - name: Install composer dependencies
  46. run: composer install --no-progress --prefer-dist --optimize-autoloader
  47. - name: Code Analysis (PHP CS-Fixer)
  48. if: matrix.code-style == 'yes'
  49. run: PHP_CS_FIXER_IGNORE_ENV=true php vendor/bin/php-cs-fixer fix --dry-run --diff
  50. - name: Code Analysis (PHPStan)
  51. if: matrix.code-analysis == 'yes'
  52. run: composer phpstan
  53. - name: Run application server
  54. run: php -S localhost:8000 -t tests/www 2>/dev/null &
  55. - name: Test with phpunit
  56. run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
  57. - name: Code Coverage
  58. uses: codecov/codecov-action@v4
  59. if: matrix.coverage != 'none'