run-tests.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Run tests
  2. on:
  3. workflow_call:
  4. inputs:
  5. deps:
  6. type: string
  7. required: false
  8. default: stable
  9. continue_on_error:
  10. type: boolean
  11. required: false
  12. default: false
  13. jobs:
  14. test:
  15. name: PHP ${{ matrix.php }}
  16. runs-on: ubuntu-latest
  17. strategy:
  18. fail-fast: false
  19. matrix:
  20. php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
  21. steps:
  22. - name: Check out code
  23. uses: actions/checkout@v3.5.3
  24. - name: Install PHP
  25. uses: shivammathur/setup-php@2.25.4
  26. with:
  27. php-version: ${{ matrix.php }}
  28. tools: composer:v2
  29. coverage: none
  30. - name: Set up problem matchers
  31. run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
  32. - name: Update to dev stability
  33. if: inputs.deps == 'dev'
  34. run: |
  35. composer config minimum-stability dev
  36. composer config prefer-stable false
  37. - name: Install dependencies
  38. if: inputs.deps != 'lowest'
  39. uses: nick-fields/retry@v2.8.3
  40. with:
  41. timeout_minutes: 5
  42. max_attempts: 5
  43. command: composer update --no-interaction --no-progress
  44. - name: Install dependencies (--prefer-lowest)
  45. if: inputs.deps == 'lowest'
  46. uses: nick-fields/retry@v2.8.3
  47. with:
  48. timeout_minutes: 5
  49. max_attempts: 5
  50. command: composer update --prefer-lowest --prefer-stable --no-interaction --no-progress
  51. - name: Install PHPUnit
  52. uses: nick-fields/retry@v2.8.3
  53. with:
  54. timeout_minutes: 5
  55. max_attempts: 5
  56. command: composer bin phpunit update --no-interaction --no-progress
  57. - name: Run tests
  58. if: inputs.continue_on_error == false
  59. run: make test
  60. - name: Run tests (but don't complain)
  61. if: inputs.continue_on_error == true
  62. run: make test
  63. continue-on-error: true
  64. - name: Upload coverage
  65. uses: codecov/codecov-action@v3.1.4