steps:
  - label: ":ruby: {{ matrix.ruby_source}}:{{ matrix.ruby }} :phone: Transport: {{ matrix.transport }} :elasticsearch: Suite: {{ matrix.suite }}"
    agents:
      provider: "gcp"
    env:
      RUBY_VERSION: "{{ matrix.ruby }}"
      TEST_SUITE: "{{ matrix.suite }}"
      STACK_VERSION: 8.17.0-SNAPSHOT
      TRANSPORT_VERSION: "{{ matrix.transport }}"
      RUBY_SOURCE: "{{ matrix.ruby_source }}"
      QUIET: false
    matrix:
      setup:
        suite:
          - "free"
          - "platinum"
        ruby:
          - "3.3"
          - "3.2"
          - "3.1"
        transport:
          - "8.3"
        ruby_source:
          - 'ruby'
      # Only run platinum once for the latest Ruby. You can use lots of combinations, check the
      # documentation on https://buildkite.com/docs/pipelines/build-matrix for more information.
      adjustments:
        - with:
            suite: "platinum"
            ruby: "3.2"
          skip: true
        - with:
            suite: "platinum"
            ruby: "3.1"
          skip: true
        - with:
            suite: "free"
            ruby: "3.3"
            ruby_source: "ruby"
            transport: "8.1"
        - with:
            suite: "free"
            ruby: "3.3"
            ruby_source: "ruby"
            transport: "8.2"
        - with:
            suite: "free"
            ruby: "3.3"
            ruby_source: "ruby"
            transport: "main"
        - with:
            suite: "free"
            ruby: "9.4"
            ruby_source: "jruby"
            transport: "8.3"
    command: ./.buildkite/run-tests.sh
    # I'm publishing test results to HTML and JUnit in this directory and this directive makes them
    # available in the Artifacts tab of a build in Buildkite.
    artifact_paths: "elasticsearch-api/tmp/*"
  - label: ":ruby: :yaml: Test suite"
    agents:
      provider: "gcp"
    env:
      RUBY_VERSION: "3.3"
      STACK_VERSION: 8.17.0-SNAPSHOT
      ES_YAML_TESTS_BRANCH: 8.17
      TRANSPORT_VERSION: "8.3"
      RUBY_SOURCE: "ruby"
      TEST_SUITE: "platinum"
    command: ./.buildkite/run-yaml-tests.sh
  - wait: ~
    continue_on_failure: true
  - label: "Log Results"
    command: ./.buildkite/log-results.sh
