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

Conversation

anandhkb
Copy link
Contributor

@anandhkb anandhkb commented Jul 8, 2022

cpp_changed==cpp+python+notebooks, python_changed==python+notebooks, notebooks_changed==notebooks

@anandhkb anandhkb requested a review from a team as a code owner July 8, 2022 04:53
@rlratzel rlratzel added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jul 8, 2022
@rlratzel rlratzel added this to the 22.08 milestone Jul 8, 2022
@BradReesWork BradReesWork added this to PRs in 22.08 Release Jul 8, 2022
Copy link
Contributor

@rlratzel rlratzel left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. I have a few suggestions and change requests to hopefully fix the CI failures.

ci/test.sh Outdated
Comment on lines 29 to 53
PRHTTP=https://api.github.com/repos/rapidsai/cugraph/pulls/${PR_ID}/files
fnames=`curl -sb -X GET -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GHTK" $PRHTTP | python3 -c "import sys, json; print([labels['filename'] for labels in json.load(sys.stdin)])"`
cpp_changed="false" python_changed="false" nb_changed="false" doc_changed="false"
for fname in ${fnames[@]}
do
if [[ "$fname" == *"cpp/cmake/"* || "$fname" == *"cpp/CMakeLists.txt"* || "$fname" == *"cpp/src/"* || "$fname" == *"cpp/include/"* || "$fname" == *"cpp/tests/"* || "$fname" == *"cpp/libcugraph_etl/"* || "$fname" == *"cpp/scripts/"* ]]; then
cpp_changed="true" python_changed="true" nb_changed="true" doc_changed="true"
fi
if [[ "$fname" == *"python/"* ]]; then
python_changed="true" nb_changed="true" doc_changed="true"
fi
if [[ "$fname" == *"docs/"* ]]; then
doc_changed="true"
fi
if [[ "$fname" == *"notebooks/"* ]]; then
nb_changed="true"
fi
done

if [[ "$nb_changed" == "false" ]]; then
export NB_CHANGED="FALSE"
else
export NB_CHANGED="TRUE"
fi

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this code would be more appropriate in ci/gpu/build.sh and have the variables exported and then referenced in the lower-level scripts (like you're doing for the test-notebooks.sh script). The main reason being that test.sh is sometimes also used by devs outside of CI, and this code would prevent that due to how it's trying to access info about a PR. It would also mean you wouldn't have to source test.sh (which can sometimes have unintended side-effects) since the variables would be set in the top-level calling script.

Once this code is moved out, test.sh should be written to also handle cases where the various python_changed, nb_changed, etc. variables are not set, so devs can continue to run test.sh outside of CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, thanks Rick

ci/test.sh Outdated
cpp_changed="true" python_changed="true" nb_changed="true" doc_changed="true"
fi
if [[ "$fname" == *"python/"* ]]; then
python_changed="true" nb_changed="true" doc_changed="true"
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to make the variable names a little more accurate, since python_changed implies python code changed when it could actually be set by way of a C++ code change. Perhaps the naming convention could be run_python_tests, run_nb_tests, etc.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense

ci/gpu/build.sh Outdated
${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
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the codecov step below will fail if python tests aren't run, since the python tests generate the output needed by codecov. You might try adding something to this if block to prevent codecov from running if python tests did not run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, thanks Rick

ci/test.sh Outdated
else
export NB_CHANGED="TRUE"
fi

export RAPIDS_DATASET_ROOT_DIR=${RAPIDS_DATASET_ROOT_DIR:-${CUGRAPH_ROOT}/datasets}
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the CI failures, it looks like this isn't being set properly beause CUGRAPH_ROOT isn't being set properly, because (I think) this script is now being source'd . I think my other suggestion would eliminate the need to source this script and should fix that problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good

ci/test.sh Outdated
else
export NB_CHANGED="TRUE"
fi

Copy link
Contributor

Choose a reason for hiding this comment

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

Somewhere around here might be a good place to print a summary of what's going to be run, what's going to be skipped, and (most importantly) why, since it might be confusing to devs who are expecting certain tests to run which end up getting skipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair ask, will do

Copy link
Member

@ajschmidt8 ajschmidt8 left a comment

Choose a reason for hiding this comment

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

We can't merge these changes in their current state.

ci/gpu/build.sh Outdated
# Identify relevant testsets to run in CI based on the ChangeList
################################################################################

PRHTTP=https://api.github.com/repos/rapidsai/cugraph/pulls/${PR_ID}/files
Copy link
Member

Choose a reason for hiding this comment

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

This file is used in more than just PR builds. It's also used for nightly branch builds. For those builds, there is no PR_ID number available so these changes will fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ajschmidt8 , how to distinguish the nightly builds from the PR builds then? Based on that, I can add an 'if condition' and hide the new code under that 'if block'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if [ "$BUILD_MODE" = "pull-request" ]; then

fi

Copy link
Member

@ajschmidt8 ajschmidt8 left a comment

Choose a reason for hiding this comment

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

Left some suggestions. Also, I don't see the doc_changed value being used anywhere throughout the PR. Can this be removed?

ci/gpu/build.sh Outdated Show resolved Hide resolved
ci/gpu/build.sh Outdated
run_cpp_tests="true" run_python_tests="true" run_nb_tests="true"
fi
# this will not do anything if the 'fnames' array is empty
for fname in ${fnames[@]}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for fname in ${fnames[@]}
for fname in "${fnames[@]}"

Add some quotes here

Copy link
Contributor

@rlratzel rlratzel left a comment

Choose a reason for hiding this comment

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

Looks good. I have one suggestion but it need not hold up my approval.

ci/gpu/build.sh Outdated Show resolved Hide resolved
Copy link
Member

@ajschmidt8 ajschmidt8 left a comment

Choose a reason for hiding this comment

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

Approved pending the resolution of Rick's comment

ci/gpu/build.sh Outdated Show resolved Hide resolved
@anandhkb
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 920340d into branch-22.08 Jul 12, 2022
22.08 Release automation moved this from PRs to Done Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
No open projects
22.08 Release
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants