feat(cli): add vbs binaries list and fetch
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 18s

This commit is contained in:
faumaray committed 2026-12-03 21:10:20 +03:00
1 parent 8245a209a5
commit 8fd8c34525
8 files changed
+158 -1

No files matched your search

+45
View File
@@ -710,6 +710,51 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include
auto r2 = Platform::run_supervised(pub2);
Void::Testing::expect(r2.has_value() && r2->succeeded());
// 1b. Binary variant CLI: publish, list, and fetch the artifact.
const auto binary_artifact = tmp / "binary_artifact.bin";
(void)Platform::atomic_write_file(binary_artifact, "CLI_BINARY_VARIANT_BYTES", false);
Platform::ProcessRequest bin_pub;
bin_pub.executable = vbs_bin;
bin_pub.arguments = {"publish-binary",
"--registry",
reg_url,
"--name",
"hello-pkg",
"--version",
"1.1.0",
"--variant",
"cli-variant",
"--file",
binary_artifact.string()};
bin_pub.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok;
auto bin_pub_res = Platform::run_supervised(bin_pub);
Void::Testing::expect(bin_pub_res.has_value() && bin_pub_res->succeeded());
Platform::ProcessRequest bin_list;
bin_list.executable = vbs_bin;
bin_list.arguments = {"binaries", "list", "--registry", reg_url,
"--name", "hello-pkg", "--version", "1.1.0"};
bin_list.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok;
auto bin_list_res = Platform::run_supervised(bin_list);
Void::Testing::expect(bin_list_res.has_value() && bin_list_res->succeeded());
if (bin_list_res) {
Void::Testing::expect(bin_list_res->stdout_data.find("cli-variant") != std::string::npos);
Void::Testing::expect(bin_list_res->stdout_data.find("unsigned") != std::string::npos);
}
const auto fetched_artifact = tmp / "fetched_binary.bin";
Platform::ProcessRequest bin_fetch;
bin_fetch.executable = vbs_bin;
bin_fetch.arguments = {"binaries", "fetch", "--registry", reg_url,
"--name", "hello-pkg", "--version", "1.1.0",
"--variant", "cli-variant", "--output", fetched_artifact.string()};
bin_fetch.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok;
auto bin_fetch_res = Platform::run_supervised(bin_fetch);
Void::Testing::expect(bin_fetch_res.has_value() && bin_fetch_res->succeeded());
auto fetched_bytes = Void::FileSystem::read_file(fetched_artifact);
Void::Testing::require(fetched_bytes.has_value());
Void::Testing::expect(*fetched_bytes == "CLI_BINARY_VARIANT_BYTES");
// 2. Create a consumer project declaring `.package("hello-pkg", "^1.0").registry(reg_url)`.
const auto cons_dir = tmp / "consumer";
const auto cons_build = tmp / "consumer_build";