Skip to content
Draft
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
25 changes: 25 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.1")

git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

git_repository(
name = "flagd_schemas",
build_file = "//providers/flagd:flagd_schemas.BUILD",
Expand All @@ -42,3 +44,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",
)

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"],
)
32 changes: 32 additions & 0 deletions providers/flagd/cwt_cucumber.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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/');
sed "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"],
)
47 changes: 47 additions & 0 deletions providers/flagd/tests/gherkin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")

SRCS = [
"steps.cpp",
"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",
"@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,
deps = DEPS,
)

cc_test(
name = "gherkin_test",
srcs = SRCS,
args = [
"$(locations @flagd_testbed//:features)",
],
copts = ["-std=c++20"],
data = DATA,
# TODO(#91): This tag disables those tests from github action check
# We should remove it once all tests will be passing
tags = ["manual"],
deps = DEPS,
)
Loading
Loading