Skip to content
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

Run relevant CI tests based on what's changed in the ChangeList #2396

Merged
merged 9 commits into from
Jul 12, 2022
Merged
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
63 changes: 57 additions & 6 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,49 @@ else
gpuci_mamba_retry install cugraph pylibcugraph -c ${CONDA_BLD_DIR} -c ${CONDA_ARTIFACT_PATH}
fi

################################################################################
# Identify relevant testsets to run in CI based on the ChangeList
################################################################################

fnames=()
# Initialize all the run variables to true, as we want to run all the tests if the build_mode is NOT a pull-request
run_cpp_tests="true" run_python_tests="true" run_nb_tests="true"
if [ "$BUILD_MODE" == "pull-request" ]; then
PR_ENDPOINT="https://api.github.com/repos/rapidsai/cugraph/pulls/${PR_ID}/files"
fnames=(
$(
curl -s \
-X GET \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GHTK" \
"$PR_ENDPOINT" | \
jq -r '.[].filename'
)
)
# Initialize all the run variables to false, for pull-requests only, later, based on what's changed, these variables will be set to true
run_cpp_tests="false" run_python_tests="false" run_nb_tests="false"
fi
# this will not do anything if the 'fnames' array is empty
for fname in "${fnames[@]}"
do
if [[ "$fname" == *"cpp/"* && "$fname" != *"cpp/docs/"* && "$fname" != *"cpp/doxygen/"* ]]; then
run_cpp_tests="true" run_python_tests="true" run_nb_tests="true"
fi
if [[ "$fname" == *"python/"* ]]; then
run_python_tests="true" run_nb_tests="true"
fi
if [[ "$fname" == *"notebooks/"* ]]; then
run_nb_tests="true"
fi
done
################################################################################
# PRINT SUMMARY OF TESTS to BE EXECUTED
################################################################################
gpuci_logger "Summary of CI tests to be executed"
gpuci_logger "Run cpp tests=$run_cpp_tests"
gpuci_logger "Run python tests=$run_python_tests"
gpuci_logger "Run notebook tests=$run_nb_tests"

################################################################################
# TEST
################################################################################
Expand Down Expand Up @@ -146,16 +189,24 @@ else
fi

gpuci_logger "Running cuGraph test.sh..."
${WORKSPACE}/ci/test.sh ${TEST_MODE_FLAG} | tee testoutput.txt
if [[ $run_cpp_tests == "true" ]]; then
${WORKSPACE}/ci/test.sh ${TEST_MODE_FLAG} --run-cpp-tests --run-python-tests | tee testoutput.txt
elif [[ $run_python_tests == "true" ]]; then
${WORKSPACE}/ci/test.sh ${TEST_MODE_FLAG} --run-python-tests | tee testoutput.txt
else
${WORKSPACE}/ci/test.sh ${TEST_MODE_FLAG} | tee testoutput.txt
fi
gpuci_logger "Ran cuGraph test.sh : return code was: $?, gpu/build.sh exit code is now: $EXITCODE"

gpuci_logger "Running cuGraph notebook test script..."
${WORKSPACE}/ci/gpu/test-notebooks.sh 2>&1 | tee nbtest.log
gpuci_logger "Ran cuGraph notebook test script : return code was: $?, gpu/build.sh exit code is now: $EXITCODE"
python ${WORKSPACE}/ci/utils/nbtestlog2junitxml.py nbtest.log
if [[ $run_nb_tests == "true" ]]; then
gpuci_logger "Running cuGraph notebook test script..."
${WORKSPACE}/ci/gpu/test-notebooks.sh 2>&1 | tee nbtest.log
gpuci_logger "Ran cuGraph notebook test script : return code was: $?, gpu/build.sh exit code is now: $EXITCODE"
python ${WORKSPACE}/ci/utils/nbtestlog2junitxml.py nbtest.log
fi
fi

if [ -n "${CODECOV_TOKEN}" ]; then
if [[ -n "${CODECOV_TOKEN}" && $run_python_tests == "true" ]]; then
codecov -t $CODECOV_TOKEN
fi

Expand Down
30 changes: 16 additions & 14 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set +e

if (python ${CUGRAPH_ROOT}/ci/utils/is_pascal.py); then
echo "WARNING: skipping C++ tests on Pascal GPU arch."
else
elif hasArg "--run-cpp-tests"; then
echo "C++ gtests for cuGraph (single-GPU only)..."
for gt in "${CONDA_PREFIX}/bin/gtests/libcugraph/"*_TEST; do
test_name=$(basename $gt)
Expand All @@ -84,21 +84,23 @@ else
done
fi

echo "Python pytest for pylibcugraph..."
cd ${CUGRAPH_ROOT}/python/pylibcugraph/pylibcugraph
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-pylibcugraph-pytests.xml -v --cov-config=.coveragerc --cov=pylibcugraph --cov-report=xml:${WORKSPACE}/python/pylibcugraph/pylibcugraph-coverage.xml --cov-report term --ignore=raft --benchmark-disable
echo "Ran Python pytest for pylibcugraph : return code was: $?, test script exit code is now: $EXITCODE"
if hasArg "--run-python-tests"; then
echo "Python pytest for pylibcugraph..."
cd ${CUGRAPH_ROOT}/python/pylibcugraph/pylibcugraph
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-pylibcugraph-pytests.xml -v --cov-config=.coveragerc --cov=pylibcugraph --cov-report=xml:${WORKSPACE}/python/pylibcugraph/pylibcugraph-coverage.xml --cov-report term --ignore=raft --benchmark-disable
echo "Ran Python pytest for pylibcugraph : return code was: $?, test script exit code is now: $EXITCODE"

echo "Python pytest for cuGraph (single-GPU only)..."
cd ${CUGRAPH_ROOT}/python/cugraph/cugraph
# rmat is not tested because of MG testing
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-cugraph-pytests.xml -v --cov-config=.coveragerc --cov=cugraph --cov-report=xml:${WORKSPACE}/python/cugraph/cugraph-coverage.xml --cov-report term --ignore=raft --ignore=tests/mg --ignore=tests/generators --benchmark-disable
echo "Ran Python pytest for cugraph : return code was: $?, test script exit code is now: $EXITCODE"
echo "Python pytest for cuGraph (single-GPU only)..."
cd ${CUGRAPH_ROOT}/python/cugraph/cugraph
# rmat is not tested because of MG testing
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-cugraph-pytests.xml -v --cov-config=.coveragerc --cov=cugraph --cov-report=xml:${WORKSPACE}/python/cugraph/cugraph-coverage.xml --cov-report term --ignore=raft --ignore=tests/mg --ignore=tests/generators --benchmark-disable
echo "Ran Python pytest for cugraph : return code was: $?, test script exit code is now: $EXITCODE"

echo "Python benchmarks for cuGraph (running as tests)..."
cd ${CUGRAPH_ROOT}/benchmarks
pytest -v -m "managedmem_on and poolallocator_on and tiny" --benchmark-disable
echo "Ran Python benchmarks for cuGraph (running as tests) : return code was: $?, test script exit code is now: $EXITCODE"
echo "Python benchmarks for cuGraph (running as tests)..."
cd ${CUGRAPH_ROOT}/benchmarks
pytest -v -m "managedmem_on and poolallocator_on and tiny" --benchmark-disable
echo "Ran Python benchmarks for cuGraph (running as tests) : return code was: $?, test script exit code is now: $EXITCODE"
fi

echo "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}