build.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. on:
  2. - pull_request
  3. - push
  4. name: build
  5. jobs:
  6. tests:
  7. name: PHP-${{ matrix.php }}-${{ matrix.os }}
  8. env:
  9. key: cache-v1
  10. runs-on: ${{ matrix.os }}
  11. strategy:
  12. matrix:
  13. os:
  14. - ubuntu-latest
  15. php:
  16. - "5.4"
  17. - "5.5"
  18. - "5.6"
  19. - "7.0"
  20. - "7.1"
  21. - "7.2"
  22. - "7.3"
  23. - "7.4"
  24. - "8.0"
  25. composer:
  26. - "dev-master"
  27. steps:
  28. - name: Configure git
  29. run: git config --global core.autocrlf false
  30. - name: Checkout
  31. uses: actions/checkout@v2.3.4
  32. - name: Determine composer cache directory
  33. run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
  34. - name: Cache dependencies installed with composer
  35. uses: actions/cache@v2
  36. with:
  37. path: ${{ env.COMPOSER_CACHE_DIR }}
  38. key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
  39. restore-keys: |
  40. php${{ matrix.php }}-composer-
  41. - name: Install composer
  42. run: composer require --dev "composer/composer:${{ matrix.composer }}" --update-with-dependencies
  43. - name: Run tests with phpunit
  44. if: matrix.php != '7.4'
  45. run: |
  46. vendor/bin/phpunit --verbose --colors=always
  47. cd tests/scripts && sh run.sh
  48. - name: Run tests with phpunit
  49. if: matrix.php == '7.4'
  50. run: |
  51. vendor/bin/phpunit --verbose --coverage-clover=clover.xml --colors=always
  52. cd tests/scripts && sh run.sh
  53. - name: Upload code coverage scrutinizer
  54. if: matrix.php == '7.4'
  55. run: |
  56. wget https://scrutinizer-ci.com/ocular.phar
  57. php ocular.phar code-coverage:upload --format=php-clover coverage.clover