name: Test
inputs:
  testArtifacts:
    default: null
    required: false
  runTestsParameters:
    default: ''
    required: false
runs:
  using: composite
  steps:
    - shell: bash
      run: |
        set -x
        export SKIP_IO_CAPTURE_TESTS=1
        export CI_NO_IPV6=1
        export TEST_PHP_JUNIT=junit.out.xml
        sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
          -j$(sysctl -n hw.ncpu) \
          -g FAIL,BORK,LEAK,XLEAK \
          --no-progress \
          --offline \
          --show-diff \
          --show-slow 1000 \
          --set-timeout 120
    - uses: actions/upload-artifact@v3
      if: always() && inputs.testArtifacts != null
      with:
        name: ${{ github.job }}_${{ inputs.testArtifacts }}
        path: ${{ github.workspace }}/junit.out.xml
        retention-days: 5
