Skip to content
Closed
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
22 changes: 21 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ jobs:
- '!.cursor-plugin/**'
- '!.claude-plugin/**'
- '!gemini-extension.json'
has_non_lp_mip_changes:
- '**'
- '!cpp/src/math_optimization/**'
- '!cpp/src/pdlp/**'
- '!cpp/src/dual_simplex/**'
- '!cpp/src/cuts/**'
- '!cpp/src/barrier/**'
- '!cpp/src/mip_heuristics/**'
- '!cpp/src/branch_and_bound/**'
- '!cpp/tests/dual_simplex/**'
- '!cpp/tests/linear_programming/**'
- '!cpp/tests/mip/**'
Comment on lines +280 to +291
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python - <<'PY'
import pathlib
import re

workflow = pathlib.Path(".github/workflows/pr.yaml").read_text()

# Extract has_non_lp_mip_changes block
m = re.search(r'^\s*has_non_lp_mip_changes:\n((?:\s+- .+\n)+)', workflow, re.M)
if not m:
    raise SystemExit("Could not find has_non_lp_mip_changes block in .github/workflows/pr.yaml")

block = m.group(1).splitlines()
excluded_prefixes = []
for line in block:
    s = line.strip()
    if s.startswith("- '!") and s.endswith("/**'"):
        excluded_prefixes.append(s[len("- '!"):-len("/**'")])

# Candidate LP/MIP-related files in repo (heuristic by path tokens)
tokens = (
    "mip", "lp", "pdlp", "dual_simplex", "linear_programming",
    "math_optimization", "branch_and_bound", "barrier", "cuts"
)

candidates = []
for p in pathlib.Path(".").rglob("*"):
    if not p.is_file():
        continue
    ps = p.as_posix()
    if ".git/" in ps:
        continue
    low = ps.lower()
    if any(t in low for t in tokens):
        covered = any(ps.startswith(prefix + "/") for prefix in excluded_prefixes)
        if not covered:
            candidates.append(ps)

print("Excluded prefixes from has_non_lp_mip_changes:")
for ep in excluded_prefixes:
    print("  -", ep)

print("\nPotential LP/MIP-related files NOT covered by exclusions:")
for c in sorted(candidates):
    print("  -", c)

print(f"\nTotal uncovered candidates: {len(candidates)}")
PY

Repository: NVIDIA/cuopt

Length of output: 16454


Verify has_non_lp_mip_changes covers all LP/MIP-owned paths.

The exclusion list is incomplete. Currently excluded are only cpp/src/ and cpp/tests/ directories, but significant LP/MIP-related files exist elsewhere:

  • cpp/include/cuopt/linear_programming/** (38 files) — public API headers for LP/MIP solvers
  • python/cuopt/cuopt/linear_programming/** (20+ files) — Python LP module
  • benchmarks/linear_programming/** — benchmark infrastructure
  • datasets/linear_programming/** and datasets/mip/** — test data
  • python/cuopt_server/...linear_programming/** — server-side LP utilities and tests
  • regression/lp_*.sh and regression/mip_*.sh — regression test suites
  • Documentation and skill examples containing LP/MIP examples (50+ files)

PRs touching only these files will incorrectly be treated as has_non_lp_mip_changes=true, causing routing tests to run unnecessarily. Add these paths to the exclusion list or document the intended scope.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr.yaml around lines 280 - 291, The has_non_lp_mip_changes
exclusion list is incomplete and misses multiple LP/MIP-owned paths, causing
irrelevant CI routing; update the has_non_lp_mip_changes pattern set to also
exclude the public headers and other LP/MIP directories (examples:
cpp/include/cuopt/linear_programming/**,
python/cuopt/cuopt/linear_programming/**, benchmarks/linear_programming/**,
datasets/linear_programming/** and datasets/mip/**,
python/cuopt_server/**/linear_programming/**, regression/lp_*.sh and
regression/mip_*.sh, plus docs/ and skills/examples paths that contain LP/MIP
examples) so that only truly non-LP/MIP changes flip has_non_lp_mip_changes;
locate the has_non_lp_mip_changes block in the workflow and add the
corresponding glob patterns (using the same negation style like '!cpp/src/...'
already present) to the list.

checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@main
Expand Down Expand Up @@ -305,6 +317,8 @@ jobs:
script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }}
script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY
script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }}
script-env-secret-4-key: SKIP_ROUTING_TESTS
script-env-secret-4-value: ${{ (!fromJSON(needs.changed-files.outputs.changed_file_groups).has_non_lp_mip_changes) && 'true' || 'false' }}
conda-python-build:
needs: [conda-cpp-build, compute-matrix-filters]
secrets: inherit
Expand All @@ -329,6 +343,8 @@ jobs:
script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }}
script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY
script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }}
script-env-secret-4-key: SKIP_ROUTING_TESTS
script-env-secret-4-value: ${{ (!fromJSON(needs.changed-files.outputs.changed_file_groups).has_non_lp_mip_changes) && 'true' || 'false' }}
docs-build:
needs: [conda-python-build, changed-files]
secrets: inherit
Expand Down Expand Up @@ -390,6 +406,8 @@ jobs:
script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }}
script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY
script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }}
script-env-secret-4-key: SKIP_ROUTING_TESTS
script-env-secret-4-value: ${{ (!fromJSON(needs.changed-files.outputs.changed_file_groups).has_non_lp_mip_changes) && 'true' || 'false' }}
wheel-build-cuopt-server:
needs: [checks, compute-matrix-filters]
secrets: inherit
Expand Down Expand Up @@ -430,11 +448,13 @@ jobs:
script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }}
script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY
script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }}
script-env-secret-4-key: SKIP_ROUTING_TESTS
script-env-secret-4-value: ${{ (!fromJSON(needs.changed-files.outputs.changed_file_groups).has_non_lp_mip_changes) && 'true' || 'false' }}
test-self-hosted-server:
needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files]
secrets: inherit
uses: ./.github/workflows/self_hosted_service_test.yaml
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels && fromJSON(needs.changed-files.outputs.changed_file_groups).has_non_lp_mip_changes
with:
build_type: pull-request
script: ci/test_self_hosted_service.sh
21 changes: 21 additions & 0 deletions ci/run_ctests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,29 @@ else
exit 1
fi

# Routing test binaries to skip when SKIP_ROUTING_TESTS is set
ROUTING_TESTS=(
ROUTING_TEST
ROUTING_GES_TEST
VEHICLE_ORDER_TEST
VEHICLE_TYPES_TEST
OBJECTIVE_FUNCTION_TEST
RETAIL_L1TEST
ROUTING_L1TEST
ROUTING_UNIT_TEST
WAYPOINT_MATRIXTEST
)

for gt in "${GTEST_DIR}"/*_TEST; do
test_name=$(basename "${gt}")
if [[ "${SKIP_ROUTING_TESTS:-}" == "true" ]]; then
for routing_test in "${ROUTING_TESTS[@]}"; do
if [[ "${test_name}" == "${routing_test}" ]]; then
echo "Skipping routing gtest ${test_name} (SKIP_ROUTING_TESTS=true)"
continue 2
fi
done
fi
echo "Running gtest ${test_name}"
"${gt}" "$@"
done
Expand Down
8 changes: 7 additions & 1 deletion ci/run_cuopt_pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ set -euo pipefail
# Support invoking run_cuopt_pytests.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/cuopt/cuopt/

pytest -s --cache-clear "$@" tests
PYTEST_ARGS=("$@")
if [[ "${SKIP_ROUTING_TESTS:-}" == "true" ]]; then
echo "Skipping routing tests (SKIP_ROUTING_TESTS=true)"
PYTEST_ARGS+=("--ignore=tests/routing")
fi

pytest -s --cache-clear "${PYTEST_ARGS[@]}" tests
17 changes: 16 additions & 1 deletion ci/run_cuopt_server_pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,19 @@ set -euo pipefail
# Support invoking run_cuopt_server_pytests.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/cuopt_server/cuopt_server/

pytest -s --cache-clear "$@" tests
PYTEST_ARGS=("$@")
if [[ "${SKIP_ROUTING_TESTS:-}" == "true" ]]; then
echo "Skipping routing tests (SKIP_ROUTING_TESTS=true)"
PYTEST_ARGS+=(
"--ignore=tests/test_server.py"
"--ignore=tests/test_set_cost_matrix.py"
"--ignore=tests/test_set_cost_waypoint_graph.py"
"--ignore=tests/test_set_fleet_data.py"
"--ignore=tests/test_set_task_data.py"
"--ignore=tests/test_set_travel_time_waypoint_graph.py"
"--ignore=tests/test_initial_solutions.py"
"--ignore=tests/test_multi_cost.py"
)
fi

pytest -s --cache-clear "${PYTEST_ARGS[@]}" tests
8 changes: 5 additions & 3 deletions ci/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ rapids-logger "Download datasets"

RAPIDS_DATASET_ROOT_DIR="$(realpath datasets)"
export RAPIDS_DATASET_ROOT_DIR
pushd "${RAPIDS_DATASET_ROOT_DIR}"
./get_test_data.sh
popd
if [[ "${SKIP_ROUTING_TESTS:-}" != "true" ]]; then
pushd "${RAPIDS_DATASET_ROOT_DIR}"
./get_test_data.sh
popd
fi

EXITCODE=0
trap "EXITCODE=1" ERR
Expand Down
8 changes: 5 additions & 3 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ RAPIDS_DATASET_ROOT_DIR="$(realpath datasets)"
export RAPIDS_DATASET_ROOT_DIR
./datasets/linear_programming/download_pdlp_test_dataset.sh
./datasets/mip/download_miplib_test_dataset.sh
pushd "${RAPIDS_DATASET_ROOT_DIR}"
./get_test_data.sh
popd
if [[ "${SKIP_ROUTING_TESTS:-}" != "true" ]]; then
pushd "${RAPIDS_DATASET_ROOT_DIR}"
./get_test_data.sh
popd
fi

rapids-logger "Check GPU usage"
nvidia-smi
Expand Down
10 changes: 6 additions & 4 deletions ci/test_wheel_cuopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ fi

./datasets/linear_programming/download_pdlp_test_dataset.sh
./datasets/mip/download_miplib_test_dataset.sh
cd ./datasets
./get_test_data.sh --solomon
./get_test_data.sh --tsp
cd -
if [[ "${SKIP_ROUTING_TESTS:-}" != "true" ]]; then
cd ./datasets
./get_test_data.sh --solomon
./get_test_data.sh --tsp
cd -
fi

RAPIDS_DATASET_ROOT_DIR="$(realpath datasets)"
export RAPIDS_DATASET_ROOT_DIR
Expand Down