build.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. name: build
  2. on:
  3. - push
  4. - pull_request
  5. jobs:
  6. tests:
  7. name: PHP ${{ matrix.php }} Test on ${{ matrix.os }}
  8. env:
  9. extensions: bz2, dom, iconv, fileinfo, openssl, xml, zlib
  10. key: cache-v1
  11. strategy:
  12. matrix:
  13. os:
  14. - ubuntu-latest
  15. - windows-latest
  16. php:
  17. - '7.4'
  18. - '8.0'
  19. runs-on: ${{ matrix.os }}
  20. steps:
  21. -
  22. name: Checkout
  23. uses: actions/checkout@v1
  24. -
  25. name: Install linux dependencies
  26. if: matrix.os == 'ubuntu-latest'
  27. run: sudo apt-get install unzip p7zip-full
  28. -
  29. name: Install PHP with extensions
  30. uses: shivammathur/setup-php@v2
  31. with:
  32. php-version: ${{ matrix.php }}
  33. extensions: ${{ env.extensions }}
  34. coverage: pcov
  35. ini-values: date.timezone='UTC', memory_limit=-1
  36. tools: composer:v2
  37. -
  38. name: Determine composer cache directory on Linux
  39. if: matrix.os == 'ubuntu-latest'
  40. run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
  41. -
  42. name: Determine composer cache directory on Windows
  43. if: matrix.os == 'windows-latest'
  44. run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
  45. -
  46. name: Cache composer dependencies
  47. uses: actions/cache@v2
  48. with:
  49. path: ${{ env.COMPOSER_CACHE_DIR }}
  50. key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
  51. restore-keys: php${{ matrix.php }}-composer-
  52. -
  53. name: Check PHP Version
  54. run: php -v
  55. -
  56. name: Check Composer Version
  57. run: composer -V
  58. -
  59. name: Check PHP Extensions
  60. run: php -m
  61. -
  62. name: Validate composer.json and composer.lock
  63. run: composer validate
  64. -
  65. name: Install dependencies with composer
  66. run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
  67. -
  68. name: Run tests with phpunit
  69. run: vendor/bin/phpunit --colors=always