shell_commands: &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"

matrix:
  bazel:
  - 7.x
  - last_green
  platform:
  - ubuntu2004
tasks:
  verify_targets:
    name: Verify build targets
    bazel: ${{ bazel }}
    platform: ${{ platform }}
    environment:
      CC: "clang"
      SWIFT_VERSION: "5.5.3"
      SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
      PATH: "$PATH:$SWIFT_HOME/usr/bin"
    shell_commands: *shell_commands
    build_flags:
    - "--action_env=PATH"
    build_targets:
    - "@rules_swift//examples/xplatform/..."
    - "-@rules_swift//examples/xplatform/deprecated_grpc/..." # TODO: Fix grpc on Linux
    - "-@rules_swift//examples/xplatform/grpc/..." # TODO: Fix grpc on Linux
    - "-@rules_swift//examples/xplatform/proto_library_group/..." # TODO: Fix grpc on Linux
  verify_targets_macos:
    name: Verify build targets
    bazel: ${{ bazel }}
    platform: macos
    build_targets:
    - "@rules_swift//examples/apple/..."
    build_flags:
    - "--repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1"
