-
Notifications
You must be signed in to change notification settings - Fork 164
[FEA] Add selective test execution for PR builds #931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
b93bd54
09489bf
60af7c6
1e33a30
675eac2
a39469c
616ab1b
88eb4cc
620ec72
11d3454
808ff45
b59a15b
47bc15e
c0eeb44
cf79254
52a11a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -277,6 +277,67 @@ jobs: | |||||||||||||
| - '!.cursor-plugin/**' | ||||||||||||||
| - '!.claude-plugin/**' | ||||||||||||||
| - '!gemini-extension.json' | ||||||||||||||
| test_routing: | ||||||||||||||
| - 'cpp/src/routing/**' | ||||||||||||||
| - 'cpp/src/distance/**' | ||||||||||||||
| - 'cpp/tests/routing/**' | ||||||||||||||
| - 'cpp/tests/distance_engine/**' | ||||||||||||||
| - 'cpp/tests/examples/routing/**' | ||||||||||||||
| - 'python/cuopt/cuopt/routing/**' | ||||||||||||||
| - 'python/cuopt/cuopt/tests/routing/**' | ||||||||||||||
| - 'regression/routing*' | ||||||||||||||
| - 'cpp/include/**' | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| - 'cpp/cmake/**' | ||||||||||||||
| - 'cpp/CMakeLists.txt' | ||||||||||||||
| - 'cpp/src/utilities/**' | ||||||||||||||
| - 'cpp/tests/CMakeLists.txt' | ||||||||||||||
| - 'cpp/tests/utilities/**' | ||||||||||||||
| - 'python/cuopt/cuopt/*.py' | ||||||||||||||
| - 'python/cuopt/cuopt/distance_engine/**' | ||||||||||||||
| - 'python/cuopt/cuopt/utils/**' | ||||||||||||||
| - 'python/libcuopt/**' | ||||||||||||||
| - 'conda/**' | ||||||||||||||
| - 'dependencies.yaml' | ||||||||||||||
| test_lp: | ||||||||||||||
| - 'cpp/src/dual_simplex/**' | ||||||||||||||
| - 'cpp/src/barrier/**' | ||||||||||||||
| - 'cpp/src/pdlp/**' | ||||||||||||||
| - 'cpp/src/math_optimization/**' | ||||||||||||||
| - 'cpp/tests/linear_programming/**' | ||||||||||||||
| - 'cpp/tests/dual_simplex/**' | ||||||||||||||
| - 'cpp/tests/qp/**' | ||||||||||||||
| - 'python/cuopt/cuopt/tests/linear_programming/**' | ||||||||||||||
| - 'python/cuopt/cuopt/tests/quadratic_programming/**' | ||||||||||||||
| - 'regression/lp*' | ||||||||||||||
| - 'cpp/include/**' | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| - 'cpp/cmake/**' | ||||||||||||||
| - 'cpp/CMakeLists.txt' | ||||||||||||||
| - 'cpp/src/utilities/**' | ||||||||||||||
| - 'cpp/tests/CMakeLists.txt' | ||||||||||||||
| - 'cpp/tests/utilities/**' | ||||||||||||||
| - 'python/cuopt/cuopt/*.py' | ||||||||||||||
| - 'python/cuopt/cuopt/distance_engine/**' | ||||||||||||||
| - 'python/cuopt/cuopt/utils/**' | ||||||||||||||
| - 'python/libcuopt/**' | ||||||||||||||
| - 'conda/**' | ||||||||||||||
| - 'dependencies.yaml' | ||||||||||||||
| test_mip: | ||||||||||||||
| # Note: MIP has no separate Python tests (tested through LP tests). | ||||||||||||||
| # If MIP-specific Python tests are added, include their paths here. | ||||||||||||||
| - 'cpp/src/branch_and_bound/**' | ||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||
| - 'cpp/src/cuts/**' | ||||||||||||||
| - 'cpp/src/mip_heuristics/**' | ||||||||||||||
| - 'cpp/tests/mip/**' | ||||||||||||||
| - 'regression/mip*' | ||||||||||||||
| - 'cpp/include/**' | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| - 'cpp/cmake/**' | ||||||||||||||
| - 'cpp/CMakeLists.txt' | ||||||||||||||
| - 'cpp/src/utilities/**' | ||||||||||||||
| - 'cpp/tests/CMakeLists.txt' | ||||||||||||||
| - 'cpp/tests/utilities/**' | ||||||||||||||
| - 'python/libcuopt/**' | ||||||||||||||
| - 'conda/**' | ||||||||||||||
| - 'dependencies.yaml' | ||||||||||||||
| checks: | ||||||||||||||
| secrets: inherit | ||||||||||||||
| uses: rapidsai/shared-workflows/.github/workflows/[email protected] | ||||||||||||||
|
|
@@ -296,7 +357,11 @@ jobs: | |||||||||||||
| if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp | ||||||||||||||
| with: | ||||||||||||||
| build_type: pull-request | ||||||||||||||
| script: ci/test_cpp.sh | ||||||||||||||
| script: | | ||||||||||||||
| export CUOPT_ROUTING_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_routing }}" | ||||||||||||||
| export CUOPT_LP_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_lp }}" | ||||||||||||||
| export CUOPT_MIP_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_mip }}" | ||||||||||||||
| ci/test_cpp.sh | ||||||||||||||
| matrix_filter: ${{ needs.compute-matrix-filters.outputs.conda_test_filter }} | ||||||||||||||
| secrets: | ||||||||||||||
| script-env-secret-1-key: CUOPT_DATASET_S3_URI | ||||||||||||||
|
|
@@ -320,7 +385,11 @@ jobs: | |||||||||||||
| with: | ||||||||||||||
| run_codecov: false | ||||||||||||||
| build_type: pull-request | ||||||||||||||
| script: ci/test_python.sh | ||||||||||||||
| script: | | ||||||||||||||
| export CUOPT_ROUTING_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_routing }}" | ||||||||||||||
| export CUOPT_LP_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_lp }}" | ||||||||||||||
| export CUOPT_MIP_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_mip }}" | ||||||||||||||
| ci/test_python.sh | ||||||||||||||
| matrix_filter: ${{ needs.compute-matrix-filters.outputs.conda_test_filter }} | ||||||||||||||
| secrets: | ||||||||||||||
| script-env-secret-1-key: CUOPT_DATASET_S3_URI | ||||||||||||||
|
|
@@ -381,7 +450,11 @@ jobs: | |||||||||||||
| if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels | ||||||||||||||
| with: | ||||||||||||||
| build_type: pull-request | ||||||||||||||
| script: ci/test_wheel_cuopt.sh | ||||||||||||||
| script: | | ||||||||||||||
| export CUOPT_ROUTING_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_routing }}" | ||||||||||||||
| export CUOPT_LP_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_lp }}" | ||||||||||||||
| export CUOPT_MIP_CHANGED="${{ fromJSON(needs.changed-files.outputs.changed_file_groups).test_mip }}" | ||||||||||||||
| ci/test_wheel_cuopt.sh | ||||||||||||||
| matrix_filter: ${{ needs.compute-matrix-filters.outputs.wheel_lean_filter }} | ||||||||||||||
| secrets: | ||||||||||||||
| script-env-secret-1-key: CUOPT_DATASET_S3_URI | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Derives CUOPT_TEST_COMPONENTS from changed-files env vars | ||
| # (CUOPT_ROUTING_CHANGED, CUOPT_LP_CHANGED, CUOPT_MIP_CHANGED). | ||
| # | ||
| # When none of these env vars are set (e.g. nightly / non-PR builds), | ||
| # defaults to "all" so every test runs. | ||
| # | ||
| # Usage: source ./ci/derive_test_components.sh | ||
|
|
||
| if [[ -z "${CUOPT_ROUTING_CHANGED:-}" && -z "${CUOPT_LP_CHANGED:-}" && -z "${CUOPT_MIP_CHANGED:-}" ]]; then | ||
| export CUOPT_TEST_COMPONENTS="all" | ||
| else | ||
| components="" | ||
| [[ "${CUOPT_ROUTING_CHANGED:-true}" == "true" ]] && components="${components:+${components},}routing" | ||
| [[ "${CUOPT_LP_CHANGED:-true}" == "true" ]] && components="${components:+${components},}lp" | ||
| [[ "${CUOPT_MIP_CHANGED:-true}" == "true" ]] && components="${components:+${components},}mip" | ||
| # Fallback to "all" if all components are false (defensive — the job-level | ||
| # 'if' gate in pr.yaml would normally skip the job entirely in this case). | ||
| export CUOPT_TEST_COMPONENTS="${components:-all}" | ||
| fi | ||
| echo "CUOPT_TEST_COMPONENTS=${CUOPT_TEST_COMPONENTS}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,44 @@ | |
|
|
||
| set -euo pipefail | ||
|
|
||
| # Determine which test binary belongs to which component | ||
| should_run_test() { | ||
| local test_name="$1" | ||
| local components="${CUOPT_TEST_COMPONENTS:-all}" | ||
|
|
||
| # If all components should run, return true | ||
| if [[ "${components}" == "all" ]]; then | ||
| return 0 | ||
| fi | ||
|
|
||
| # Map test binary names to components | ||
| case "${test_name}" in | ||
| ROUTING_*|WAYPOINT_*|VEHICLE_*|OBJECTIVE_*|RETAIL_*) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a suggestion, please explore if you can come across better approach. I am trying to see how to make it easier to manage, if we can have these tests installed per module, like routing, lp, milp, it would be easier to just add those directory instead of adding each new test to this list. We may have to update cpp/test/CmakeLists.txt to keep the lower folders intact so we can use them
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rgsl888prabhu Great suggestion! I think we can update ConfigureTest() to install tests into per-module subdirectories (like bin/gtests/libcuopt/routing/, lp/, mip/ run_ctests.sh Since it touches the CMake build system and all the test CMakeLists, I'd prefer to keep it as a separate follow-up PR to avoid mixing it with the CI changes here. I'll open one once this is merged. Does that sound good?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you considered cmake test labels? I'm pretty concerned about the maintainability of having hardcoded test names in this file
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, harcoded test cases might create missing tests. I was thinking to tackle this in a follow-up PR, but since we have crossed 26.04 release, may be we can push updates as well in the same PR so there are no breakages in between.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mlubin Added label based gtests
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mlubin May I get your review on this ? |
||
| [[ "${components}" == *"routing"* ]] && return 0 | ||
| ;; | ||
| LP_*|PDLP_*|C_API_*|DUAL_SIMPLEX_*|QP_*) | ||
| [[ "${components}" == *"lp"* ]] && return 0 | ||
| ;; | ||
| MIP_*|PROBLEM_*|ELIM_*|STANDARDIZATION_*|MULTI_PROBE_*|INCUMBENT_*|DOC_EXAMPLE_*|CUTS_*|EMPTY_*|DETERMINISM_*) | ||
|
rgsl888prabhu marked this conversation as resolved.
Outdated
|
||
| [[ "${components}" == *"mip"* ]] && return 0 | ||
| ;; | ||
| # UNIT_TEST and PRESOLVE_TEST can belong to LP or MIP | ||
| UNIT_TEST|PRESOLVE_TEST) | ||
| [[ "${components}" == *"mip"* || "${components}" == *"lp"* ]] && return 0 | ||
| ;; | ||
| # CLI_TEST is a general utility test, run if any component is selected | ||
| CLI_TEST) | ||
| return 0 | ||
| ;; | ||
| # Unknown tests: run them to be safe | ||
| *) | ||
| return 0 | ||
| ;; | ||
| esac | ||
|
|
||
| return 1 | ||
| } | ||
|
|
||
| # Support customizing the gtests' install location | ||
| # First, try the installed location (CI/conda environments) | ||
| installed_test_location="${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libcuopt/" | ||
|
|
@@ -23,8 +61,12 @@ fi | |
|
|
||
| for gt in "${GTEST_DIR}"/*_TEST; do | ||
| test_name=$(basename "${gt}") | ||
| echo "Running gtest ${test_name}" | ||
| "${gt}" "$@" | ||
| if should_run_test "${test_name}"; then | ||
| echo "Running gtest ${test_name}" | ||
| "${gt}" "$@" | ||
| else | ||
| echo "Skipping gtest ${test_name} (not in CUOPT_TEST_COMPONENTS=${CUOPT_TEST_COMPONENTS:-all})" | ||
| fi | ||
| done | ||
|
|
||
| # Run C_API_TEST with CPU memory for local solves (excluding time limit tests) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.