Skip to content

Commit

Permalink
Merge pull request #280 from northwesternfintech/binary-path-vars
Browse files Browse the repository at this point in the history
Fixed binary path vars within CI
  • Loading branch information
stevenewald authored Oct 5, 2024
2 parents 8b6aa0f + 4f05807 commit 2935b5e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/exchange-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ jobs:
LLVM_DIR: '/usr/lib/llvm-18/lib/cmake/llvm'
NUTC_WRAPPER_BINARY_PATH: ${{ github.workspace }}/exchange/build/WRAPPER
NUTC_CPP_TEMPLATE_PATH: ${{ github.workspace }}/exchange/template.cpp
NUTC_LINTER_SPAWNER_BINARY_PATH: ${{ github.workspace }}/exchange/build/LINTER-spawner
NUTC_LINTER_SPAWNER_BINARY_PATH: ${{ github.workspace }}/exchange/build/LINTER_spawner

steps:
- uses: actions/checkout@v3
Expand Down
13 changes: 9 additions & 4 deletions exchange/src/exchange/wrappers/handle/wrapper_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@ namespace nutc::exchange {
const fs::path&
WrapperHandle::wrapper_binary_path()
{
static constexpr auto WRAPPER_BINARY_PATH_ENV_VAR = "NUTC_WRAPPER_BINARY_PATH";
static const char* const wrapper_binary_location =
std::getenv("NUTC_WRAPPER_BINARY_PATH");
std::getenv(WRAPPER_BINARY_PATH_ENV_VAR);

if (wrapper_binary_location == nullptr) [[unlikely]] {
throw std::runtime_error("NUTC_WRAPPER_BINARY_PATH environment variable not set"
throw std::runtime_error(
fmt::format("{} environment variable not set", WRAPPER_BINARY_PATH_ENV_VAR)
);
}

static const fs::path wrapper_binary_path{wrapper_binary_location};
if (!fs::exists(wrapper_binary_path))
throw std::runtime_error("File at NUTC_WRAPPER_BINARY_PATH does not exist");
if (!fs::exists(wrapper_binary_path)) {
throw std::runtime_error(
fmt::format("File at {} does not exist", WRAPPER_BINARY_PATH_ENV_VAR)
);
}

return wrapper_binary_path;
}
Expand Down
7 changes: 5 additions & 2 deletions exchange/src/linter/spawning/spawning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ LintProcessManager::spawner_binary_path()
}

static const std::filesystem::path spawner_binary_path{spawner_binary_location};
if (!std::filesystem::exists(spawner_binary_path))
throw std::runtime_error("File at NUTC_SPAWNER_BINARY_PATH does not exist");
if (!std::filesystem::exists(spawner_binary_path)) {
throw std::runtime_error(
fmt::format("File at {} does not exist", LINTER_SPAWNER_BINARY_ENV_VAR)
);
}

return spawner_binary_path;
}
Expand Down

0 comments on commit 2935b5e

Please sign in to comment.