Skip to content
Open
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
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,39 @@ jobs:
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
script: ci/build_cpp.sh
java-build-matrix:
needs: cpp-build
permissions:
contents: read
uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main
with:
build_type: pull-request
matrix_name: conda-cpp-build
matrix_filter: map(select(.ARCH == "amd64"))
Comment on lines +63 to +71

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow and the referenced shared workflow usage in context.
git ls-files .github/workflows/build.yaml .github/workflows/*.yaml .github/actions 2>/dev/null || true

printf '\n--- build.yaml (lines 1-220) ---\n'
nl -ba .github/workflows/build.yaml | sed -n '1,220p'

printf '\n--- search for build_type usage in workflows ---\n'
rg -n "build_type:\s*|inputs\.build_type|compute-matrix\.yaml|java-build-matrix|java-build" .github/workflows .github/actions -g '*.yml' -g '*.yaml' || true

Repository: NVIDIA/cuopt

Length of output: 713


🏁 Script executed:

#!/bin/bash
set -euo pipefail
git ls-files .github/workflows/build.yaml .github/workflows/*.yaml .github/actions 2>/dev/null || true

printf '\n--- build.yaml (lines 1-220) ---\n'
nl -ba .github/workflows/build.yaml | sed -n '1,220p'

printf '\n--- search for build_type usage in workflows ---\n'
rg -n "build_type:\s*|inputs\.build_type|compute-matrix\.yaml|java-build-matrix|java-build" .github/workflows .github/actions -g '*.yml' -g '*.yaml' || true

Repository: NVIDIA/cuopt

Length of output: 713


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- .github/workflows/build.yaml (lines 1-220) ---\n'
awk '{printf("%5d  %s\n", NR, $0)}' .github/workflows/build.yaml | sed -n '1,220p'

printf '\n--- search for workflow triggers / build_type in .github/workflows/build.yaml ---\n'
rg -n "on:|workflow_call|workflow_dispatch|schedule:|build_type:|java-build-matrix|java-build:" .github/workflows/build.yaml

Repository: NVIDIA/cuopt

Length of output: 10559


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- usages of compute-matrix.yaml across repo ---\n'
rg -n "compute-matrix\.yaml@main|matrix_name: conda-cpp-build|matrix_filter:" .github/workflows -g '*.yml' -g '*.yaml'

printf '\n--- relevant workflow context around any other compute-matrix callsites ---\n'
for f in .github/workflows/*.yaml .github/workflows/*.yml; do
  [ -f "$f" ] || continue
  if rg -q "compute-matrix\.yaml@main" "$f"; then
    echo "### $f"
    awk '{printf("%5d  %s\n", NR, $0)}' "$f" | rg -n "compute-matrix\.yaml@main|matrix_name:|build_type:|needs:|strategy:|uses:"
    echo
  fi
done

Repository: NVIDIA/cuopt

Length of output: 9030


Use the workflow build_type for java-build-matrix.

.github/workflows/build.yaml:67-70 runs on push, tags, and manual nightly dispatch, but this matrix is still hardcoded to pull-request, so branch/nightly runs compute the wrong Java matrix.

Fix
-      build_type: pull-request
+      build_type: ${{ inputs.build_type || 'branch' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
java-build-matrix:
needs: cpp-build
permissions:
contents: read
uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main
with:
build_type: pull-request
matrix_name: conda-cpp-build
matrix_filter: map(select(.ARCH == "amd64"))
java-build-matrix:
needs: cpp-build
permissions:
contents: read
uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main
with:
build_type: ${{ inputs.build_type || 'branch' }}
matrix_name: conda-cpp-build
matrix_filter: map(select(.ARCH == "amd64"))
🤖 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 @.github/workflows/build.yaml around lines 63 - 71, The java-build-matrix job
is still hardcoded to use pull-request, which causes the wrong Java matrix for
non-PR runs. Update the workflow input in build.yaml so the uses:
compute-matrix.yaml call for java-build-matrix passes the same build_type used
by the workflow instead of a fixed value, keeping the matrix selection aligned
with the trigger type.

java-build:
needs: java-build-matrix
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.java-build-matrix.outputs.matrix) }}
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
node_type: "gpu-l4-latest-1"
arch: "amd64"
container_image: "rapidsai/ci-conda:26.08-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
script: "ci/build_java.sh"
artifact-name: "cuopt-java-cuda${{ matrix.CUDA_VER }}"
file_to_upload: "java/cuopt/target/"
python-build:
needs: [cpp-build]
permissions:
Expand Down Expand Up @@ -272,6 +305,7 @@ jobs:
# so 'test.yaml' can be triggered without waiting for those.
needs:
- upload-conda
- java-build
- wheel-publish-cuopt
- wheel-publish-cuopt-server
- wheel-publish-cuopt-sh-client
Expand Down
58 changes: 57 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
- checks
- conda-cpp-build
- conda-cpp-tests
- java-build-matrix
- java-build
- conda-python-build
- conda-python-tests
- docs-build
Expand Down Expand Up @@ -165,19 +167,22 @@ jobs:
- '!README.md'
- '!SECURITY.md'
- '!ci/build_wheel*.sh'
- '!ci/build_java.sh'
- '!ci/check_style.sh'
- '!ci/docker/**'
- '!ci/release/**'
- '!ci/run_*.pytests.sh'
- '!ci/run_ctests.sh'
- '!ci/test_cpp*.sh'
- '!ci/test_java.sh'
- '!ci/test_notebooks.sh'
- '!ci/test_python.sh'
- '!ci/test_self_hosted_service.sh'
- '!ci/test_wheel*.sh'
- '!ci/thirdparty-testing/**'
- '!container-builder/**'
- '!helmchart/**'
- '!java/**'
- '!ngc/**'
- '!sonar-project.properties'
- '!sonarqube/**'
Expand Down Expand Up @@ -223,12 +228,14 @@ jobs:
- '!SECURITY.md'
- '!agents/**'
- '!ci/build_docs.sh'
- '!ci/build_java.sh'
- '!ci/build_python.sh'
- '!ci/build_wheel*.sh'
- '!ci/check_style.sh'
- '!ci/docker/**'
- '!ci/release/**'
- '!ci/test_python.sh'
- '!ci/test_java.sh'
- '!ci/test_self_hosted_service.sh'
- '!ci/test_wheel*.sh'
- '!ci/thirdparty-testing/**'
Expand All @@ -239,6 +246,7 @@ jobs:
- '!gemini-extension.json'
- '!helmchart/**'
- '!img/**'
- '!java/**'
- '!ngc/**'
- '!notebooks/**'
- '!python/**'
Expand All @@ -252,6 +260,14 @@ jobs:
- '!sonarqube/**'
- '!ucf/**'
- '!utilities/**'
test_java:
- 'java/**'
- 'ci/build_java.sh'
- 'ci/test_java.sh'
- 'dependencies.yaml'
- '.github/workflows/pr.yaml'
- '.github/workflows/build.yaml'
- '.github/workflows/test.yaml'
test_python_conda:
- '**'
- '!**/*.md'
Expand Down Expand Up @@ -292,11 +308,13 @@ jobs:
- '!SECURITY.md'
- '!agents/**'
- '!ci/build_docs.sh'
- '!ci/build_java.sh'
- '!ci/build_wheel*.sh'
- '!ci/check_style.sh'
- '!ci/docker/**'
- '!ci/release/**'
- '!ci/test_self_hosted_service.sh'
- '!ci/test_java.sh'
- '!ci/test_wheel*.sh'
- '!ci/thirdparty-testing/**'
- '!ci/utils/sync_skills_version.sh'
Expand All @@ -306,6 +324,7 @@ jobs:
- '!gemini-extension.json'
- '!helmchart/**'
- '!img/**'
- '!java/**'
- '!ngc/**'
- '!notebooks/**'
- '!skills/**/SKILL.md'
Expand Down Expand Up @@ -360,11 +379,13 @@ jobs:
- '!ci/build_cpp.sh'
- '!ci/build_docs.sh'
- '!ci/build_python.sh'
- '!ci/build_java.sh'
- '!ci/check_style.sh'
- '!ci/docker/**'
- '!ci/release/**'
- '!ci/run_ctests.sh'
- '!ci/test_python.sh'
- '!ci/test_java.sh'
- '!ci/thirdparty-testing/**'
- '!ci/utils/sync_skills_version.sh'
- '!ci/utils/validate_skills.sh'
Expand All @@ -373,6 +394,7 @@ jobs:
- '!gemini-extension.json'
- '!helmchart/**'
- '!img/**'
- '!java/**'
- '!ngc/**'
- '!notebooks/**'
- '!skills/**/SKILL.md'
Expand All @@ -393,9 +415,10 @@ jobs:
enable_check_generated_files: false
conda-cpp-build:
needs: [checks, compute-matrix-filters, changed-files]
# Consumed by conda-cpp-tests, conda-python-build, and (transitively) docs-build.
# Consumed by C++, Java, Python, and docs jobs.
if: >-
fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp ||
fromJSON(needs.changed-files.outputs.changed_file_groups).test_java ||
fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda ||
fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs
permissions:
Expand Down Expand Up @@ -490,6 +513,39 @@ jobs:
artifact-name: "cuopt_docs"
container_image: "rapidsai/ci-conda:26.08-latest"
script: "ci/build_docs.sh"
java-build-matrix:
needs: [conda-cpp-build, changed-files]
permissions:
contents: read
uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main
if: >-
fromJSON(needs.changed-files.outputs.changed_file_groups).test_java ||
fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp
with:
build_type: pull-request
matrix_name: conda-cpp-build
matrix_filter: map(select(.ARCH == "amd64"))
java-build:
needs: java-build-matrix
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.java-build-matrix.outputs.matrix) }}
with:
build_type: pull-request
node_type: "gpu-l4-latest-1"
arch: "amd64"
container_image: "rapidsai/ci-conda:26.08-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
script: "ci/test_java.sh"
artifact-name: "cuopt-java-cuda${{ matrix.CUDA_VER }}"
file_to_upload: "java/cuopt/target/"
wheel-build-libcuopt:
needs: [compute-matrix-filters, changed-files]
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ jobs:
script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY
script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }}

conda-java-tests:
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix:
cuda_version:
- "12.9.1"
- "13.2.0"
with:
build_type: ${{ inputs.build_type }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
node_type: "gpu-l4-latest-1"
arch: "amd64"
container_image: "rapidsai/ci-conda:26.08-cuda${{ matrix.cuda_version }}-ubuntu24.04-py3.13"
script: "ci/test_java.sh"

wheel-tests-cuopt:
permissions:
actions: read
Expand Down Expand Up @@ -142,6 +167,7 @@ jobs:
needs:
- conda-cpp-tests
- conda-python-tests
- conda-java-tests
- wheel-tests-cuopt
- wheel-tests-cuopt-server
- conda-notebook-tests
Expand Down
57 changes: 57 additions & 0 deletions ci/build_java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

RUN_TESTS=false
if [[ "${1:-}" == "--run-java-tests" ]]; then
RUN_TESTS=true
elif [[ $# -gt 0 ]]; then
echo "Usage: $0 [--run-java-tests]" >&2
exit 2
fi

if [[ -e /opt/conda/etc/profile.d/conda.sh ]]; then
. /opt/conda/etc/profile.d/conda.sh
fi

rapids-logger "Configuring conda strict channel priority"
conda config --set channel_priority strict

rapids-logger "Downloading the C++ artifact"
CPP_CHANNEL=$(rapids-download-from-github \
"$(rapids-artifact-name conda_cpp libcuopt cuopt --cuda "$RAPIDS_CUDA_VERSION")")

rapids-logger "Generating Java build dependencies"
ENV_YAML_DIR=$(mktemp -d)
rapids-dependency-file-generator \
--output conda \
--file-key java \
--prepend-channel "${CPP_CHANNEL}" \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" | tee "${ENV_YAML_DIR}/env.yaml"

rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n java \
--channel "${CPP_CHANNEL}"

# Temporarily allow unbound variables for conda activation.
set +u
conda activate java
set -u

rapids-print-env

export CUOPT_PREFIX="${CONDA_PREFIX}"
export CUOPT_JAVA_NATIVE_BUILD_DIR="${PWD}/java/cuopt/build/native"

if [[ "${RUN_TESTS}" == true ]]; then
rapids-logger "Building and testing the Java bindings"
bash java/cuopt/scripts/test.sh
else
rapids-logger "Building the Java bindings"
bash java/cuopt/scripts/build_native.sh
mvn -f java/cuopt/pom.xml clean package \
-DskipTests \
-Dcuopt.native.dir="${CUOPT_JAVA_NATIVE_BUILD_DIR}"
fi
5 changes: 5 additions & 0 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ for DEP in "${DEPENDENCIES[@]}"; do
done
done

# Update the Java API version. Keep the RAPIDS YY.MM.PP format used by VERSION.
for FILE in java/*/pom.xml; do
sed_runner "/<!--CUOPT_JAVA#VERSION_UPDATE_MARKER_START-->.*<!--CUOPT_JAVA#VERSION_UPDATE_MARKER_END-->/s//<!--CUOPT_JAVA#VERSION_UPDATE_MARKER_START--><version>${NEXT_FULL_TAG}<\/version><!--CUOPT_JAVA#VERSION_UPDATE_MARKER_END-->/g" "${FILE}"
done

# Update README.md version badge
sed_runner 's/badge\/version-[0-9]\+\.[0-9]\+\.[0-9]\+-blue/badge\/version-'${NEXT_FULL_TAG}'-blue/g' README.md

Expand Down
12 changes: 12 additions & 0 deletions ci/test_java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

rapids-logger "Checking GPU availability"
nvidia-smi

rapids-logger "Running the Java build and tests"
ci/build_java.sh --run-java-tests
14 changes: 14 additions & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ files:
- test_cpp
- test_cpp_cuopt
- depends_on_libcuopt
java:
output: none
includes:
- build_common
- cuda
- cuda_version
- depends_on_libcuopt
- java
test_python:
output: none
includes:
Expand Down Expand Up @@ -275,6 +283,12 @@ dependencies:
- libprotobuf
- libabseil
- re2
java:
common:
- output_types: conda
packages:
- maven
- openjdk=11.*
test_cpp:
common:
- output_types: [conda]
Expand Down
Loading