php.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: Unit-tests
  2. on:
  3. push:
  4. paths:
  5. - '**.php'
  6. - 'composer.json'
  7. - '**.yml'
  8. # Trigger the workflow on any pull request
  9. pull_request:
  10. jobs:
  11. test:
  12. name: Test on php ${{ matrix.php}}
  13. runs-on: ubuntu-latest
  14. timeout-minutes: 10
  15. strategy:
  16. fail-fast: true
  17. matrix:
  18. php: [ 8.1, 8.2, 8.3, 8.4] # 7.1, 7.2,
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@v4
  22. # usage refer https://github.com/shivammathur/setup-php
  23. - name: Setup PHP
  24. timeout-minutes: 5
  25. uses: shivammathur/setup-php@v2
  26. with:
  27. php-version: ${{ matrix.php}}
  28. tools: pecl, php-cs-fixer, phpunit:${{ matrix.phpunit }}
  29. extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis # , swoole-4.4.19 #optional, setup extensions
  30. ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
  31. coverage: none #optional, setup coverage driver: xdebug, none
  32. - name: Display Env
  33. run: env
  34. - name: Install dependencies
  35. run: composer install --no-progress
  36. # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
  37. # Docs: https://getcomposer.org/doc/articles/scripts.md
  38. - name: Run unit tests
  39. # run: composer run test
  40. run: phpunit