2
0

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. run: sudo apt-get install unzip p7zip-full
  27. -
  28. name: Install PHP with extensions
  29. uses: shivammathur/setup-php@v2
  30. with:
  31. php-version: ${{ matrix.php }}
  32. extensions: ${{ env.extensions }}
  33. coverage: pcov
  34. ini-values: date.timezone='UTC'
  35. tools: composer:v2
  36. -
  37. name: Determine composer cache directory on Linux
  38. if: matrix.os == 'ubuntu-latest'
  39. run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
  40. -
  41. name: Determine composer cache directory on Windows
  42. if: matrix.os == 'windows-latest'
  43. run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
  44. -
  45. name: Cache dependencies installed with composer
  46. uses: actions/cache@v2
  47. with:
  48. path: ${{ env.COMPOSER_CACHE_DIR }}
  49. key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
  50. restore-keys: |
  51. 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