steps:
  - label: >-
      :yaml: YAML test suite :ruby: {{ matrix.ruby_source}}:{{ matrix.ruby }}
      :phone: Transport {{ matrix.transport }}
    agents:
      provider: gcp
    matrix:
      setup:
        ruby:
          - '4.0'
          - '3.4'
          - '3.3'
        ruby_source:
          - ruby
        transport:
          - '8.5'
      adjustments:
        - with: # JRuby tests
            ruby: '9.4'
            ruby_source: jruby
            transport: '8.5'
        - with: # Test for main branch of transport
            ruby: '4.0'
            ruby_source: ruby
            transport: main
    env:
      RUBY_VERSION: '{{ matrix.ruby }}'
      STACK_VERSION: 9.5.0-SNAPSHOT
      ES_YAML_TESTS_BRANCH: 9.5
      TRANSPORT_VERSION: '{{ matrix.transport }}'
      RUBY_SOURCE: '{{ matrix.ruby_source }}'
      TEST_SUITE: platinum
      QUIET: true
    command: ./.buildkite/run-yaml-tests.sh
    artifact_paths: elasticsearch-api/tmp/*
  # - group: 'Elasticsearch Serverless :elasticsearch:'
  #   steps:
  #     - label: 'Create :elasticsearch: Serverless projects'
  #       key: create-serverless
  #       agents:
  #         image: 'docker.elastic.co/appex-qa/qaf:latest'
  #       env:
  #         EC_PROJECT_PREFIX: ruby
  #         EC_REGISTER_BACKEND: buildkite
  #         EC_REGION: aws-eu-west-1
  #         EC_ENV: qa
  #       commands:
  #         - mkdir ~/.elastic
  #         - touch ~/.elastic/cloud.json
  #         - >-
  #           echo "{\"api_key\":{\"qa\":\"$(vault read -field=qa
  #           secret/ci/elastic-elasticsearch-ruby/cloud-access)\"}}" >
  #           ~/.elastic/cloud.json
  #         - ./.buildkite/create-serverless.sh
  #     - label: 'Run :elasticsearch: Serverless :rspec: Tests :ruby:'
  #       key: run-serverless-tests
  #       depends_on:
  #         - step: create-serverless
  #       soft_fail:
  #         - exit_status: "*"
  #       agents:
  #         provider: gcp
  #       env:
  #         RUBY_VERSION: '3.4'
  #         RUBY_SOURCE: ruby
  #         TEST_SUITE: serverless
  #         ES_YAML_TESTS_BRANCH: 9.5
  #         QUIET: false
  #       command: ./.buildkite/run-yaml-tests.sh
  #       artifact_paths: elasticsearch-api/tmp/*
  #     - label: 'Destroy :elasticsearch: Serverless projects'
  #       depends_on:
  #         - step: run-serverless-tests
  #           allow_failure: true
  #       agents:
  #         image: 'docker.elastic.co/appex-qa/qaf:latest'
  #       env:
  #         EC_REGISTER_BACKEND: buildkite
  #         EC_ENV: qa
  #         EC_REGION: aws-eu-west-1
  #       commands:
  #         - mkdir ~/.elastic
  #         - touch ~/.elastic/cloud.json
  #         - >-
  #           export EC_PROJECT_NAME=`buildkite-agent meta-data get
  #           "EC_PROJECT_NAME"`
  #         - >-
  #           echo "{\"api_key\":{\"qa\":\"$(vault read -field=qa
  #           secret/ci/elastic-elasticsearch-ruby/cloud-access)\"}}" >
  #           ~/.elastic/cloud.json
  #         - qaf elastic-cloud projects delete
  - wait: ~
    continue_on_failure: true
  - label: Log Results
    command: ./.buildkite/log-results.sh
