tests.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: CI
  2. on:
  3. push:
  4. pull_request:
  5. # Cancels all previous workflow runs for the same branch that have not yet completed.
  6. concurrency:
  7. group: ${{ github.workflow }}-${{ github.ref }}
  8. cancel-in-progress: true
  9. defaults:
  10. run:
  11. shell: bash
  12. jobs:
  13. tests:
  14. name: Tests (PHP ${{ matrix.php }})
  15. runs-on: Ubuntu-20.04
  16. strategy:
  17. matrix:
  18. php: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
  19. fail-fast: false
  20. steps:
  21. - name: Checkout
  22. uses: actions/checkout@v2
  23. with:
  24. fetch-depth: 2
  25. - name: Setup PHP
  26. uses: shivammathur/setup-php@v2
  27. with:
  28. coverage: "xdebug"
  29. php-version: "${{ matrix.php }}"
  30. tools: composer
  31. - name: Install dependencies
  32. uses: "ramsey/composer-install@v1"
  33. with:
  34. dependency-versions: "highest"
  35. - name: Run tests
  36. run: |
  37. php test/test.php
  38. - name: Upload Coverage to CodeCov
  39. uses: codecov/codecov-action@v2
  40. - name: Upload Coverage to Scrutinizer CI (PHP < 8.0)
  41. if: "${{ matrix.php < '8.0' }}"
  42. run: |
  43. wget https://scrutinizer-ci.com/ocular.phar
  44. php ocular.phar code-coverage:upload --repository=g/php-annotations/php-annotations --format=php-clover coverage.clover
  45. - name: Upload Coverage to Scrutinizer CI (PHP >= 8.0)
  46. if: "${{ matrix.php >= '8.0' }}"
  47. run: |
  48. composer require scrutinizer/ocular
  49. vendor/bin/ocular code-coverage:upload --repository=g/php-annotations/php-annotations --format=php-clover coverage.clover