Skip to content

Commit 2258989

Browse files
committed
[SPARK-16577][SPARKR] Add CRAN documentation checks to run-tests.sh
## What changes were proposed in this pull request? (Please fill in changes proposed in this fix) ## How was this patch tested? This change adds CRAN documentation checks to be run as a part of `R/run-tests.sh` . As this script is also used by Jenkins this means that we will get documentation checks on every PR going forward. (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) Author: Shivaram Venkataraman <[email protected]> Closes #14759 from shivaram/sparkr-cran-jenkins. (cherry picked from commit 920806a) Signed-off-by: Shivaram Venkataraman <[email protected]>
1 parent ff2f873 commit 2258989

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

R/check-cran.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,22 @@ $FWDIR/create-docs.sh
4343
"$R_SCRIPT_PATH/"R CMD build $FWDIR/pkg
4444

4545
# Run check as-cran.
46-
# TODO(shivaram): Remove the skip tests once we figure out the install mechanism
47-
4846
VERSION=`grep Version $FWDIR/pkg/DESCRIPTION | awk '{print $NF}'`
4947

50-
"$R_SCRIPT_PATH/"R CMD check --as-cran SparkR_"$VERSION".tar.gz
48+
CRAN_CHECK_OPTIONS="--as-cran"
49+
50+
if [ -n "$NO_TESTS" ]
51+
then
52+
CRAN_CHECK_OPTIONS=$CRAN_CHECK_OPTIONS" --no-tests"
53+
fi
54+
55+
if [ -n "$NO_MANUAL" ]
56+
then
57+
CRAN_CHECK_OPTIONS=$CRAN_CHECK_OPTIONS" --no-manual"
58+
fi
59+
60+
echo "Running CRAN check with $CRAN_CHECK_OPTIONS options"
61+
62+
"$R_SCRIPT_PATH/"R CMD check $CRAN_CHECK_OPTIONS SparkR_"$VERSION".tar.gz
5163

5264
popd > /dev/null

R/run-tests.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,35 @@ rm -f $LOGFILE
2626
SPARK_TESTING=1 $FWDIR/../bin/spark-submit --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" --conf spark.hadoop.fs.default.name="file:///" $FWDIR/pkg/tests/run-all.R 2>&1 | tee -a $LOGFILE
2727
FAILED=$((PIPESTATUS[0]||$FAILED))
2828

29+
# Also run the documentation tests for CRAN
30+
CRAN_CHECK_LOG_FILE=$FWDIR/cran-check.out
31+
rm -f $CRAN_CHECK_LOG_FILE
32+
33+
NO_TESTS=1 NO_MANUAL=1 $FWDIR/check-cran.sh 2>&1 | tee -a $CRAN_CHECK_LOG_FILE
34+
FAILED=$((PIPESTATUS[0]||$FAILED))
35+
36+
NUM_CRAN_WARNING="$(grep -c WARNING$ $CRAN_CHECK_LOG_FILE)"
37+
NUM_CRAN_ERROR="$(grep -c ERROR$ $CRAN_CHECK_LOG_FILE)"
38+
NUM_CRAN_NOTES="$(grep -c NOTE$ $CRAN_CHECK_LOG_FILE)"
39+
2940
if [[ $FAILED != 0 ]]; then
3041
cat $LOGFILE
3142
echo -en "\033[31m" # Red
3243
echo "Had test failures; see logs."
3344
echo -en "\033[0m" # No color
3445
exit -1
3546
else
36-
echo -en "\033[32m" # Green
37-
echo "Tests passed."
38-
echo -en "\033[0m" # No color
47+
# We have 2 existing NOTEs for new maintainer, attach()
48+
# We have one more NOTE in Jenkins due to "No repository set"
49+
if [[ $NUM_CRAN_WARNING != 0 || $NUM_CRAN_ERROR != 0 || $NUM_CRAN_NOTES -gt 3 ]]; then
50+
cat $CRAN_CHECK_LOG_FILE
51+
echo -en "\033[31m" # Red
52+
echo "Had CRAN check errors; see logs."
53+
echo -en "\033[0m" # No color
54+
exit -1
55+
else
56+
echo -en "\033[32m" # Green
57+
echo "Tests passed."
58+
echo -en "\033[0m" # No color
59+
fi
3960
fi

0 commit comments

Comments
 (0)