Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/config/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,18 @@ components:
- "bdd/scenarios/**"
tasks: ["bdd-java"]

bdd-cpp:
depends_on:
- "rust-server"
- "rust-sdk"
- "sdk-cpp"
- "bdd-infrastructure"
- "ci-infrastructure"
paths:
- "bdd/cpp/**"
- "bdd/scenarios/**"
tasks: ["bdd-cpp"]

examples-rust:
depends_on:
- "rust-sdk"
Expand Down
18 changes: 18 additions & 0 deletions bdd/cpp/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

common --enable_bzlmod
1 change: 1 addition & 0 deletions bdd/cpp/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.1.1
31 changes: 31 additions & 0 deletions bdd/cpp/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

---
BasedOnStyle: Chromium
IndentWidth: 4
ColumnLimit: 120
BreakBeforeBraces: Custom
IndentCaseLabels: true
PointerAlignment: Right
AlignOperands: true
AlignConsecutiveAssignments: true
AccessModifierOffset: -2
AllowShortCaseLabelsOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: true
IndentPPDirectives: AfterHash
IncludeBlocks: Preserve
1 change: 1 addition & 0 deletions bdd/cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel-*
53 changes: 53 additions & 0 deletions bdd/cpp/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

load("@rules_cc//cc:defs.bzl", "cc_binary")

# BDD wire server: links the C++ step definitions with cucumber-cpp's main(), which starts a
# wire-protocol server on port 3902. A Ruby Cucumber runner drives the shared
# basic_messaging.feature over the wire (cucumber-cpp v0.8.0 is wire-only). main() comes from
# @cucumber-cpp//:cucumber-cpp via alwayslink, gtest provides the assertion macros, and
# @iggy_cpp//:iggy-cpp provides the SDK (built from the sibling foreign/cpp module).
cc_binary(
name = "bdd_wire_server",
srcs = glob([
"features/step_definitions/*.cpp",
"features/step_definitions/*.hpp",
]),
copts = [
"-finput-charset=UTF-8",
"-fexec-charset=UTF-8",
"-Wall",
"-Wpedantic",
"-Werror",
"-Wextra",
"-g3",
"-O0",
"-fno-omit-frame-pointer",
"-DDEBUG",
],
linkopts = ["-g"],
includes = [
"features/step_definitions",
],
testonly = True,
deps = [
"@cucumber-cpp//:cucumber-cpp",
"@googletest//:gtest",
"@iggy_cpp//:iggy-cpp",
],
)
Comment on lines +25 to +53

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the following flags: -Wall, -Wpedantic, -Werror, -Wextra, -g3, -O0, -fno-omit-frame-pointer, -DDEBUG

Also linkopts = ["-g"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added all of those to the cc_binary copts, plus linkopts = ["-g"]. compiles clean under -Werror -Wpedantic.

60 changes: 60 additions & 0 deletions bdd/cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# C++ BDD harness. bdd/cpp is a self-contained Bazel module: it builds the step definitions
# into a cucumber-cpp wire server and pulls in the Iggy C++ SDK (foreign/cpp) via
# local_path_override. A Ruby Cucumber runner reads the shared feature files and drives the
# wire server over the wire protocol (cucumber-cpp v0.8.0 is wire-only). The image therefore
# needs the Rust + Bazel + C++ toolchain (to build the wire server) and Ruby (to run cucumber).

ARG RUST_VERSION=1.96
FROM rust:${RUST_VERSION}-bookworm

RUN apt-get update && apt-get install --yes --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
ruby-full \
&& rm -rf /var/lib/apt/lists/*

# Bazelisk resolves the Bazel version from bdd/cpp/.bazelversion.
RUN curl -fsSL "https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-$(dpkg --print-architecture)" \
-o /usr/local/bin/bazel \
&& chmod +x /usr/local/bin/bazel

WORKDIR /workspace
COPY . .

# Build the cucumber-cpp wire server. bdd/cpp is its own Bazel module and links the Iggy C++
# SDK pulled in from foreign/cpp via local_path_override.
RUN cd bdd/cpp \
&& bazel build //:bdd_wire_server \
&& cp bazel-bin/bdd_wire_server /usr/local/bin/bdd_wire_server

# Install the Cucumber runner (wire-protocol driver).
RUN gem install bundler --no-document \
&& cd bdd/cpp \
&& bundle install

RUN mkdir -p /workspace/bdd/cpp/features

# Entrypoint: copy the mounted shared feature files, start the wire server, then run cucumber.
COPY bdd/cpp/scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
24 changes: 24 additions & 0 deletions bdd/cpp/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Cucumber runner that drives the C++ wire server (foreign/cpp/bdd) over the wire protocol.
# cucumber-cpp v0.8.0 only supports the wire protocol, and the wire protocol lives in the
# cucumber-wire gem; these versions match cucumber-cpp's own CI.
source "https://rubygems.org"

gem "cucumber", "7.1.0"
gem "cucumber-wire", "6.2.1"
61 changes: 61 additions & 0 deletions bdd/cpp/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
GEM
remote: https://rubygems.org/
specs:
builder (3.3.0)
cucumber (7.1.0)
builder (~> 3.2, >= 3.2.4)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-create-meta (~> 6.0, >= 6.0.1)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
cucumber-gherkin (~> 22.0, >= 22.0.0)
cucumber-html-formatter (~> 17.0, >= 17.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-wire (~> 6.2, >= 6.2.0)
diff-lcs (~> 1.4, >= 1.4.4)
mime-types (~> 3.3, >= 3.3.1)
multi_test (~> 0.1, >= 0.1.2)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-core (10.1.1)
cucumber-gherkin (~> 22.0, >= 22.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
cucumber-create-meta (6.0.4)
cucumber-messages (~> 17.1, >= 17.1.1)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-cucumber-expressions (14.0.0)
cucumber-gherkin (22.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-html-formatter (17.0.0)
cucumber-messages (~> 17.1, >= 17.1.0)
cucumber-messages (17.1.1)
cucumber-tag-expressions (4.1.0)
cucumber-wire (6.2.1)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
diff-lcs (1.6.2)
ffi (1.17.4)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x86_64-darwin)
logger (1.7.0)
memoist3 (1.0.0)
mime-types (3.7.0)
logger
mime-types-data (~> 3.2025, >= 3.2025.0507)
mime-types-data (3.2026.0414)
multi_test (0.1.2)
sys-uname (1.5.1)
ffi (~> 1.1)
memoist3 (~> 1.0.0)

PLATFORMS
aarch64-linux
arm64-darwin
ruby
x86_64-darwin

DEPENDENCIES
cucumber (= 7.1.0)
cucumber-wire (= 6.2.1)

BUNDLED WITH
2.6.9
33 changes: 33 additions & 0 deletions bdd/cpp/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

module(
name = "iggy_cpp_bdd",
)

bazel_dep(name = "rules_cc", version = "0.2.19")
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
bazel_dep(name = "cucumber-cpp", version = "0.8.0.bcr.1")

# The Iggy C++ SDK lives in the sibling foreign/cpp Bazel module. Pull it in locally so the
# wire server links against the same cxx staticlib the SDK ships, without duplicating its
# build rules here.
bazel_dep(name = "iggy_cpp", version = "0.1.0")
local_path_override(
module_name = "iggy_cpp",
path = "../../foreign/cpp",
)
Loading
Loading