---
buildifier: latest
matrix:
  bazel:
    - 7.x
    - 8.x
tasks:
  verify_ubuntu2004:
    platform: ubuntu2004
    bazel: ${{ bazel }}
    environment:
      CC: clang
      SWIFT_VERSION: "5.10"
      SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
      PATH: "$PATH:$SWIFT_HOME/usr/bin"
    shell_commands:
      - "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
      - "mkdir $SWIFT_HOME"
      - "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
    build_targets:
    - "//..."
    test_targets:
    - "//..."
  verify_ubuntu2204:
    platform: ubuntu2204
    bazel: ${{ bazel }}
    environment:
      CC: clang
      SWIFT_VERSION: "5.10"
      SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
      PATH: "$PATH:$SWIFT_HOME/usr/bin"
    shell_commands:
      - "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
      - "mkdir $SWIFT_HOME"
      - "curl https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2204/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
    build_targets:
    - "//..."
    test_targets:
    - "//..."
  test_module_cpp:
    platform: ubuntu2204
    bazel: ${{ bazel }}
    working_directory: tests/bazel_repository_test_dir
    build_targets:
    - "//..."
  test_module_ts:
    platform: ubuntu2204
    bazel: ${{ bazel }}
    working_directory: tests/ts/bazel_repository_test_dir
    test_targets:
    - "//..."
  verify_macos:
    platform: macos
    bazel: ${{ bazel }}
    xcode_version: "15.2"
    build_targets:
    - "//:flatbuffers"
    - "//:flatc"
    test_targets:
    - "//tests:flatbuffers_test"
