env:
  DOCKER_CACHE_ECR_ID: "492475357299"
  DOCKER_CACHE_ECR_REGION: "us-west-2"
steps:
  - label: ":moneybag: Enforce daily budget"
    command: "tests/buildkite/enforce_daily_budget.sh"
    key: enforce-daily-budget
    agents:
      queue: pipeline-loader
  - wait
  - block: ":rocket: Run this test job"
    if: build.pull_request.id != null || build.branch =~ /^dependabot\//
  #### -------- CONTAINER BUILD --------
  - label: ":docker: Build containers"
    commands:
      - "tests/buildkite/build-containers.sh cpu"
      - "tests/buildkite/build-containers.sh gpu"
      - "tests/buildkite/build-containers.sh gpu_build_rockylinux8"
    key: build-containers
    agents:
      queue: linux-amd64-cpu
  - wait
  #### -------- BUILD --------
  - label: ":console: Run clang-tidy"
    command: "tests/buildkite/run-clang-tidy.sh"
    key: run-clang-tidy
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build CPU"
    command: "tests/buildkite/build-cpu.sh"
    key: build-cpu
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build CPU ARM64 + manylinux_2_28_aarch64 wheel"
    command: "tests/buildkite/build-cpu-arm64.sh"
    key: build-cpu-arm64
    agents:
      queue: linux-arm64-cpu
  - label: ":console: Build CUDA + manylinux_2_28_x86_64 wheel"
    command: "tests/buildkite/build-cuda.sh"
    key: build-cuda
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build CUDA with RMM"
    command: "tests/buildkite/build-cuda-with-rmm.sh"
    key: build-cuda-with-rmm
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build R package with CUDA"
    command: "tests/buildkite/build-gpu-rpkg.sh"
    key: build-gpu-rpkg
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build JVM packages"
    timeout_in_minutes: 30
    command: "tests/buildkite/build-jvm-packages.sh"
    key: build-jvm-packages
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build libxgboost4j.so for Linux ARM64 (targeting glibc 2.17)"
    command: "tests/buildkite/build-jvm-linux-arm64-manylinux2014.sh"
    key: build-jvm-linux-arm64-manylinux2014
    agents:
      queue: linux-arm64-cpu
  - label: ":console: Build libxgboost4j.so for Linux x86_64 (targeting glibc 2.17)"
    command: "tests/buildkite/build-jvm-linux-x86_64-manylinux2014.sh"
    key: build-jvm-linux-x86_64-manylinux2014
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build JVM package doc"
    command: "tests/buildkite/build-jvm-doc.sh"
    key: build-jvm-doc
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build manylinux2014_x86_64 wheel"
    command: "tests/buildkite/build-manylinux2014.sh x86_64"
    key: build-manylinux2014-x86_64
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Build manylinux2014_aarch64 wheel"
    command: "tests/buildkite/build-manylinux2014.sh aarch64"
    key: build-manylinux2014-aarch64
    agents:
      queue: linux-arm64-cpu
  - wait
  #### -------- TEST --------
  - label: ":console: Test Python package, CPU"
    command: "tests/buildkite/test-python-cpu.sh"
    key: test-python-cpu
    agents:
      queue: linux-amd64-cpu
  - label: ":console: Test Python package, CPU ARM64"
    command: "tests/buildkite/test-python-cpu-arm64.sh"
    key: test-python-cpu-arm64
    agents:
      queue: linux-arm64-cpu
  - label: ":console: Test Python package, single GPU"
    command: "tests/buildkite/test-python-gpu.sh gpu"
    key: test-python-gpu
    agents:
      queue: linux-amd64-gpu
  - label: ":console: Run Google Tests"
    command: "tests/buildkite/test-cpp-gpu.sh"
    key: test-cpp-gpu
    agents:
      queue: linux-amd64-gpu
  - label: ":console: Run integration tests with JVM packages"
    command: "tests/buildkite/test-integration-jvm-packages.sh"
    key: test-integration-jvm-packages
    agents:
      queue: linux-amd64-cpu
  - wait
  #### -------- DEPLOY JVM --------
  - label: ":console: Deploy JVM packages"
    command: "tests/buildkite/deploy-jvm-packages.sh"
    key: deploy-jvm-packages
    agents:
      queue: linux-amd64-cpu
