action.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. name: "Setup PHP with Composer deps"
  2. inputs:
  3. os:
  4. description: 'OS version'
  5. required: true
  6. php:
  7. description: 'PHP version'
  8. required: true
  9. php-coverage:
  10. description: 'Enable coverage driver'
  11. required: false
  12. default: 'no'
  13. tools:
  14. description: 'tools'
  15. required: false
  16. default: 'none'
  17. composer-flags:
  18. description: 'Composer flags'
  19. required: false
  20. composer-flex-with-symfony-version:
  21. description: 'Sf version to determine with Flex'
  22. required: false
  23. runs:
  24. using: "composite"
  25. steps:
  26. - name: Resolve PHP tools flag
  27. uses: actions/github-script@v6
  28. id: setup-php-resolve-tools
  29. with:
  30. script: 'return "${{ inputs.composer-flex-with-symfony-version }}" ? "flex" : "none"'
  31. result-encoding: string
  32. - name: Resolve PHP coverage flag
  33. uses: actions/github-script@v6
  34. id: setup-php-resolve-coverage
  35. with:
  36. script: 'return "${{ inputs.php-coverage }}" == "yes" ? "pcov" : "none"'
  37. result-encoding: string
  38. - name: Setup PHP
  39. uses: ./.github/composite-actions/setup-php
  40. with:
  41. version: ${{ inputs.php }}
  42. coverage: ${{ steps.setup-php-resolve-coverage.outputs.result }}
  43. tools: ${{ steps.setup-php-resolve-tools.outputs.result }}, ${{ inputs.tools }}
  44. - name: Configure Symfony Flex
  45. if: inputs.composer-flex-with-symfony-version
  46. shell: bash
  47. run: composer config extra.symfony.require ${{ inputs.composer-flex-with-symfony-version }}
  48. - name: Configure Symfony ^7
  49. if: inputs.composer-flex-with-symfony-version == '^7'
  50. shell: bash
  51. run: |
  52. composer config minimum-stability RC
  53. composer remove facile-it/paraunit --dev
  54. - name: Install Composer deps
  55. uses: ./.github/composite-actions/install-composer-deps
  56. with:
  57. flags: ${{ inputs.composer-flags }}
  58. - name: Mock ParaUnit under Symfony ^7
  59. if: inputs.composer-flex-with-symfony-version == '^7'
  60. shell: bash
  61. run: |
  62. echo '#!/usr/bin/env bash' > vendor/bin/paraunit
  63. echo 'set -eu' >> vendor/bin/paraunit
  64. echo 'shift' >> vendor/bin/paraunit
  65. echo './vendor/bin/phpunit "${@}"' >> vendor/bin/paraunit
  66. chmod +x vendor/bin/paraunit