ci: fix unbound CONDA_PREFIX in test_doc_examples.sh#1462
ci: fix unbound CONDA_PREFIX in test_doc_examples.sh#1462ramakrishnap-nv wants to merge 3 commits into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test 60ef2ce |
|
/ok to test fca6276 |
fca6276 to
6a9a7d9
Compare
|
/ok to test 6a9a7d9 |
|
/ok to test 51de84a |
CONDA_PREFIX is unset in wheel test environments. Use \${CONDA_PREFIX:-}
so the variable defaults to empty rather than tripping set -o nounset.
The search loop already skips empty entries, so behavior is unchanged
in conda environments.
Fixes #1459.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
The MIP C examples directory had .c files but no Makefile, causing test_doc_examples.sh to mark all 2 examples as failed. The convex examples Makefile is generic (auto-discovers .c files) so copy it here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
fd1f3e4 to
d0bf6f5
Compare
📝 WalkthroughWalkthroughThe PR updates a shell script to handle an unset ChangesCI doc example script fix
cuOpt C MIP example Makefile
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/cuopt/source/cuopt-c/mip/examples/Makefile`:
- Line 49: `LDFLAGS` in the MIP example Makefile assumes `LIBCUOPT_LIBRARY_PATH`
is a directory, but the documented setup can populate it with the full
`libcuopt.so` file path. Update the Makefile to normalize that variable before
using it with `-L` and `-Wl,-rpath`, or change the contract so
`LIBCUOPT_LIBRARY_PATH` is explicitly directory-only; use the `LDFLAGS`
assignment as the fix point and keep it consistent with the `mip-examples.rst`
setup instructions.
- Around line 58-69: The single-example build path bypasses the path validation
step, so `make <example_name>` can fail later with missing include/library flags
instead of a clear prerequisite message. Update the `Makefile` so `check-paths`
is also required by individual target builds, either by making `$(TARGETS)`
depend on it or by adding it to the `%: %.c` pattern rule alongside the existing
`all` target behavior. Keep the fix aligned with the `all` target and
`check-paths` logic so both full and single-example builds validate paths
consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: afe6ab17-6bd6-4534-8204-e0aa7f618620
📒 Files selected for processing (2)
ci/test_doc_examples.shdocs/cuopt/source/cuopt-c/mip/examples/Makefile
|
|
||
| # Compiler flags | ||
| CFLAGS = -I$(INCLUDE_PATH) -Wall -Wextra | ||
| LDFLAGS = -L$(LIBCUOPT_LIBRARY_PATH) -lcuopt -Wl,-rpath,$(LIBCUOPT_LIBRARY_PATH) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Normalize LIBCUOPT_LIBRARY_PATH before passing it to -L.
Line 49 treats LIBCUOPT_LIBRARY_PATH as a directory, but the MIP example docs currently tell users to set it from find ... -name "libcuopt.so", which returns the full .so path. Following the documented setup will therefore produce an invalid -L.../libcuopt.so and break the build. Either convert file paths to $(dir ...) here or make the docs/variable contract explicitly directory-only. As per path instructions, docs changes should keep examples accurate and consistent with code. Based on docs/cuopt/source/cuopt-c/mip/mip-examples.rst:16-27, the current setup command assigns the library file path, not its parent directory.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/cuopt/source/cuopt-c/mip/examples/Makefile` at line 49, `LDFLAGS` in the
MIP example Makefile assumes `LIBCUOPT_LIBRARY_PATH` is a directory, but the
documented setup can populate it with the full `libcuopt.so` file path. Update
the Makefile to normalize that variable before using it with `-L` and
`-Wl,-rpath`, or change the contract so `LIBCUOPT_LIBRARY_PATH` is explicitly
directory-only; use the `LDFLAGS` assignment as the fix point and keep it
consistent with the `mip-examples.rst` setup instructions.
Source: Path instructions
| # Default target: build all examples | ||
| all: check-paths $(TARGETS) | ||
| @echo "===================================" | ||
| @echo "All examples built successfully!" | ||
| @echo "Built $(words $(TARGETS)) executables:" | ||
| @for target in $(TARGETS); do echo " - $$target"; done | ||
| @echo "===================================" | ||
|
|
||
| # Pattern rule: build any executable from corresponding .c file | ||
| %: %.c | ||
| @echo "Building $@ from $<..." | ||
| $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Run check-paths for single-example builds too.
The file advertises make <example_name>, but only all depends on check-paths. make foo drops straight into gcc with empty -I/-L flags, so users get a compiler/linker failure instead of the intended prerequisite message. Please make $(TARGETS) (or the pattern rule) depend on check-paths as well. As per path instructions, docs changes should keep examples runnable and clear for users.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/cuopt/source/cuopt-c/mip/examples/Makefile` around lines 58 - 69, The
single-example build path bypasses the path validation step, so `make
<example_name>` can fail later with missing include/library flags instead of a
clear prerequisite message. Update the `Makefile` so `check-paths` is also
required by individual target builds, either by making `$(TARGETS)` depend on it
or by adding it to the `%: %.c` pattern rule alongside the existing `all` target
behavior. Keep the fix aligned with the `all` target and `check-paths` logic so
both full and single-example builds validate paths consistently.
Source: Path instructions
jameslamb
left a comment
There was a problem hiding this comment.
It seems you might have included something you didn't mean to, will re-review once you clarify.
| @@ -0,0 +1,148 @@ | |||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |||
There was a problem hiding this comment.
What's the goal with this file?
It seems totally unrelated to the title / description / linked issue.
There was a problem hiding this comment.
Apologies, so it started with doc testing failing silently and once I fixed it, there was another error where one of the test missed a Cmake file, so I fixed that, but missed to update the description.
${CONDA_PREFIX:-}so the variable defaults to empty when unset (wheel environments). The search loop skips empty entries, so conda behavior is unchanged. Fixes ci: test_doc_examples.sh fails silently in wheel-tests-cuopt-server due to unbound CONDA_PREFIX #1459.Makefiletodocs/cuopt/source/cuopt-c/mip/examples/; without it,test_doc_examples.shmarked all MIP C examples as failed.