matrix:
  linux_platform:
    - debian11
    - ubuntu2004
    - ubuntu2204
    - ubuntu2404
  mac_platform:
    - macos
    - macos_arm64
  bazel: [7.x, 8.x, rolling]
tasks:
  verify_targets_linux:
    platform: ${{ linux_platform }}
    bazel: ${{ bazel }}
    build_flags:
      - "--cxxopt=-std=c++17"
    build_targets:
      - "@rocksdb//:rocksdb"
    test_flags:
      - "--cxxopt=-std=c++17"
    test_targets:
      - "@rocksdb//:all"
  verify_targets_linux_all_features:
    platform: ${{ linux_platform }}
    bazel: ${{ bazel }}
    build_flags:
      - "--cxxopt=-std=c++17"
      - "--@rocksdb//:with_bzip2"
      - "--@rocksdb//:with_liburing"
      - "--@rocksdb//:with_lz4"
      - "--@rocksdb//:with_zlib"
      - "--@rocksdb//:with_zstd"
    build_targets:
      - "@rocksdb//:rocksdb"
    test_flags:
      - "--cxxopt=-std=c++17"
      - "--@rocksdb//:with_bzip2"
      - "--@rocksdb//:with_liburing"
      - "--@rocksdb//:with_lz4"
      - "--@rocksdb//:with_zlib"
      - "--@rocksdb//:with_zstd"
    test_targets:
      - "@rocksdb//:all"
  verify_targets_mac:
    platform: ${{ mac_platform }}
    bazel: ${{ bazel }}
    build_flags:
      - "--cxxopt=-std=c++17"
    build_targets:
      - "@rocksdb//:rocksdb"
    test_flags:
      - "--cxxopt=-std=c++17"
    test_targets:
      - "@rocksdb//:all"
  verify_targets_mac_all_features:
    platform: ${{ mac_platform }}
    bazel: ${{ bazel }}
    build_flags:
      - "--cxxopt=-std=c++17"
      - "--@rocksdb//:with_bzip2"
      - "--@rocksdb//:with_lz4"
      - "--@rocksdb//:with_zlib"
      - "--@rocksdb//:with_zstd"
    build_targets:
      - "@rocksdb//:rocksdb"
    test_flags:
      - "--cxxopt=-std=c++17"
      - "--@rocksdb//:with_bzip2"
      - "--@rocksdb//:with_lz4"
      - "--@rocksdb//:with_zlib"
      - "--@rocksdb//:with_zstd"
    test_targets:
      - "@rocksdb//:all"
  # Most of the RocksDB features aren't available on Windows, so only build
  # RocksDB without any features enabled. Tests also don't run on Windows out
  # of the box.
  verify_targets_windows:
    platform: windows
    bazel: ${{ bazel }}
    build_flags:
      - "--cxxopt=/std:c++17"
      - "--cxxopt=/D_WIN32_WINNT=0x0602"
      - "--cxxopt=/DWINVER=0x0602"
    build_targets:
      - "@rocksdb//:rocksdb"
