-
Notifications
You must be signed in to change notification settings - Fork 932
/
Copy pathstyle.sh
executable file
·76 lines (62 loc) · 2.3 KB
/
style.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Copyright (c) 2018-2022, NVIDIA CORPORATION.
#####################
# cuDF Style Tester #
#####################
# Ignore errors and set path
set +e
PATH=/conda/bin:$PATH
LC_ALL=C.UTF-8
LANG=C.UTF-8
# Activate common conda env
. /opt/conda/etc/profile.d/conda.sh
conda activate rapids
FORMAT_FILE_URL=https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-22.08/cmake-format-rapids-cmake.json
export RAPIDS_CMAKE_FORMAT_FILE=/tmp/rapids_cmake_ci/cmake-formats-rapids-cmake.json
mkdir -p $(dirname ${RAPIDS_CMAKE_FORMAT_FILE})
wget -O ${RAPIDS_CMAKE_FORMAT_FILE} ${FORMAT_FILE_URL}
pre-commit run --hook-stage manual --all-files
PRE_COMMIT_RETVAL=$?
# Check for copyright headers in the files modified currently
COPYRIGHT=`python ci/checks/copyright.py --git-modified-only 2>&1`
CR_RETVAL=$?
# Output results if failure otherwise show pass
if [ "$CR_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: copyright check; begin output\n\n"
echo -e "$COPYRIGHT"
echo -e "\n\n>>>> FAILED: copyright check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: copyright check\n\n"
echo -e "$COPYRIGHT"
fi
# Run clang-format and check for a consistent code format
CLANG_FORMAT=`python cpp/scripts/run-clang-format.py 2>&1`
CLANG_FORMAT_RETVAL=$?
if [ "$CLANG_FORMAT_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: clang format check; begin output\n\n"
echo -e "$CLANG_FORMAT"
echo -e "\n\n>>>> FAILED: clang format check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: clang format check\n\n"
fi
# Run header meta.yml check and get results/return code
HEADER_META=`ci/checks/headers_test.sh`
HEADER_META_RETVAL=$?
echo -e "$HEADER_META"
# Run doxygen and check for missing documentation
DOXYGEN=`cd cpp/doxygen && { cat Doxyfile ; echo QUIET = YES; echo GENERATE_HTML = NO; } | doxygen - 2>&1 | tail -n +3`
DOXYGEN_RETVAL=$?
if [ "$DOXYGEN_RETVAL" != "0" ] || [ ! -z "$DOXYGEN" ]; then
echo -e "\n\n>>>> FAILED: doxygen check; begin output\n\n"
echo -e "$DOXYGEN"
DOXYGEN_RETVAL=1 #because return value is not generated by doxygen 1.8.20
echo -e "\n\n>>>> FAILED: doxygen check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: doxygen check\n\n"
fi
RETVALS=(
$CR_RETVAL $PRE_COMMIT_RETVAL $CLANG_FORMAT_RETVAL $DOXYGEN_RETVAL
)
IFS=$'\n'
RETVAL=`echo "${RETVALS[*]}" | sort -nr | head -n1`
exit $RETVAL