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
24 changes: 24 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bazel_dep(name = "rules_python", version = "2.3.2")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "googletest", version = "1.18.0.bcr.1")
bazel_dep(name = "abseil-cpp", version = "20250814.2")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "openfeature_cpp_sdk")
git_override(
module_name = "openfeature_cpp_sdk",
Expand Down Expand Up @@ -42,3 +43,26 @@ git_repository(
remote = "https://github.com/pboettch/json-schema-validator.git",
tag = "2.4.0",
)

git_repository(
name = "cwt_cucumber",
build_file = "//providers/flagd:cwt_cucumber.BUILD",
remote = "https://github.com/ThoSe1990/cwt-cucumber.git",
tag = "2.9",
Comment thread
m-olko marked this conversation as resolved.
)

git_repository(
name = "flagd_testbed",
build_file = "//providers/flagd:flagd_testbed.BUILD",
remote = "https://github.com/open-feature/flagd-testbed.git",
tag = "v3.8.0",
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "flagd_binary",
build_file_content = 'exports_files(["flagd_linux_x86_64"]) \nalias(name = "flagd", actual = "flagd_linux_x86_64", visibility = ["//visibility:public"])',
integrity = "sha256-mvJrkOJgbRKLphEoL4trq1x3K2lY8QULF+AZP91Vusk=",
urls = ["https://github.com/open-feature/flagd/releases/download/flagd%2Fv0.15.5/flagd_0.15.5_Linux_x86_64.tar.gz"],
Comment thread
coderabbitai[bot] marked this conversation as resolved.
)
38 changes: 38 additions & 0 deletions providers/flagd/cwt_cucumber.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

# Generate the version file from the template by extracting the version from CMakeLists.txt
genrule(
name = "generate_version_file",
srcs = [
"CMakeLists.txt",
"src/version.template",
],
outs = ["src/version.hpp"],
cmd = """
VERSION=$$(grep 'project(cwt-cucumber VERSION' $(location CMakeLists.txt) | sed 's/.*VERSION \\([0-9.]*\\).*/\\1/');
MAJOR=$${VERSION%%.*};
MINOR=$${VERSION#*.};
sed -e "s/@PROJECT_VERSION@/$$VERSION/g" \
-e "s/\\$${PROJECT_VERSION_MAJOR}/$$MAJOR/g" \
-e "s/\\$${PROJECT_VERSION_MINOR}/$$MINOR/g" \
-e "s/\\$${PROJECT_VERSION}/$$VERSION/g" \
$(location src/version.template) > $@
""",
)

cc_library(
name = "cwt-cucumber",
srcs = glob(
["src/**/*.cpp"],
exclude = ["src/main.cpp"],
),
hdrs = glob(
["src/**/*.hpp"],
exclude = ["src/version.hpp"],
) + [
"src/version.hpp",
],
copts = ["-std=c++20"],
strip_include_prefix = "src",
visibility = ["//visibility:public"],
)
13 changes: 13 additions & 0 deletions providers/flagd/flagd_testbed.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
exports_files(glob(["gherkin/**/*.feature"]))

filegroup(
name = "features",
srcs = glob(["gherkin/**/*.feature"]),
visibility = ["//visibility:public"],
)

filegroup(
name = "flags",
srcs = glob(["flags/**/*.json"]),
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions providers/flagd/tests/gherkin/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Checks: '-*'
2 changes: 2 additions & 0 deletions providers/flagd/tests/gherkin/.clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CompileFlags:
Add: [-std=c++20]
69 changes: 69 additions & 0 deletions providers/flagd/tests/gherkin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")

SRCS = [
"steps/config_steps.cpp",
"steps/context_steps.cpp",
"steps/evaluation_steps.cpp",
"steps/flag_steps.cpp",
"steps/lifecycle_steps.cpp",
"steps/provider_steps.cpp",
"steps/step_utils.cpp",
"steps/step_utils.h",
"test_env.cpp",
"test_env.h",
"test_runner.cpp",
"test_state.cpp",
"test_state.h",
]

DATA = [
"@flagd_binary//:flagd",
"@flagd_testbed//:features",
"@flagd_testbed//:flags",
]

DEPS = [
"//providers/flagd/src:flagd_provider",
"@bazel_tools//tools/cpp/runfiles",
"@com_github_grpc_grpc//:grpc++",
"@cwt_cucumber//:cwt-cucumber",
"@nlohmann_json//:json",
"@openfeature_cpp_sdk//openfeature",
"@openfeature_cpp_sdk//openfeature:openfeature_api",
]

cc_binary(
name = "gherkin_bin",
srcs = SRCS,
copts = ["-std=c++20"],
data = DATA,
env = {
"FLAGD_TEST_FLAGS": "$(locations @flagd_testbed//:flags)",
},
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
deps = DEPS,
)

cc_test(
name = "gherkin_test",
srcs = SRCS,
args = [
"$(locations @flagd_testbed//:features)",
],
copts = ["-std=c++20"],
data = DATA,
env = {
"FLAGD_TEST_FLAGS": "$(locations @flagd_testbed//:flags)",
},
# TODO(#91): This tag disables those tests from github action check
# We should remove it once all tests will be passing
tags = ["manual"],
Comment thread
m-olko marked this conversation as resolved.
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
deps = DEPS,
)
Loading