matrix:
  platform:
    # Disable platforms that do not support c++20.
    # - debian10
    # - ubuntu2004
    # - ubuntu2004_arm64
    - debian11
    - macos
    - macos_arm64
    - ubuntu2204
    - ubuntu2404
    # Disabled for now due to an issue with boost.context. See:
    # https://github.com/bazelbuild/bazel-central-registry/issues/3679
    # - windows
  bazel:
    - 7.x
    - 8.x
    - rolling
tasks:
  verify_targets_cpp20_boost_asio:
    platform: ${{ platform }}
    bazel: ${{ bazel }}
    build_flags:
      - '--cxxopt=-std=c++20'
      - '--host_cxxopt=-std=c++20'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    test_flags:
      - '--cxxopt=-std=c++20'
      - '--host_cxxopt=-std=c++20'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    build_targets:
      - '@asio-grpc//:asio-grpc'
    test_targets:
      - '@asio-grpc//:asio-grpc_cpp20_test'

  verify_targets_cpp20_standalone_asio:
    platform: ${{ platform }}
    bazel: ${{ bazel }}
    build_flags:
      - '--@asio-grpc//:use_standalone_asio'
      - '--cxxopt=-std=c++20'
      - '--host_cxxopt=-std=c++20'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    test_flags:
      - '--@asio-grpc//:use_standalone_asio'
      - '--cxxopt=-std=c++20'
      - '--host_cxxopt=-std=c++20'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    build_targets:
      - '@asio-grpc//:asio-grpc'
    test_targets:
      - '@asio-grpc//:asio-grpc_cpp20_test'

  verify_targets_cpp17_boost_asio:
    platform: ${{ platform }}
    bazel: ${{ bazel }}
    build_flags:
      - '--cxxopt=-std=c++17'
      - '--host_cxxopt=-std=c++17'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    test_flags:
      - '--cxxopt=-std=c++17'
      - '--host_cxxopt=-std=c++17'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    build_targets:
      - '@asio-grpc//:asio-grpc'
    test_targets:
      - '@asio-grpc//:asio-grpc_cpp17_test'

  verify_targets_cpp17_standalone_asio:
    platform: ${{ platform }}
    bazel: ${{ bazel }}
    build_flags:
      - '--@asio-grpc//:use_standalone_asio'
      - '--cxxopt=-std=c++17'
      - '--host_cxxopt=-std=c++17'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    test_flags:
      - '--@asio-grpc//:use_standalone_asio'
      - '--cxxopt=-std=c++17'
      - '--host_cxxopt=-std=c++17'
      # Disable spammy warnings in external dependencies to make build output readable.
      - '--per_file_copt=external/.*@-w'
      - '--host_per_file_copt=external/.*@-w'
      # Not supported by asio-grpc. See: src/agrpc/health_check_service.hpp
      # - '--process_headers_in_dependencies'
    build_targets:
      - '@asio-grpc//:asio-grpc'
    test_targets:
      - '@asio-grpc//:asio-grpc_cpp17_test'
