8000 CI merge check_build_doc.py into shell script · scikit-learn/scikit-learn@1c0c8d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c0c8d4

Browse files
committed
CI merge check_build_doc.py into shell script
1 parent 3d46c46 commit 1c0c8d4

File tree

2 files changed

+49
-80
lines changed

2 files changed

+49
-80
lines changed

build_tools/circle/build_doc.sh

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,63 @@ set -e
66
# documentation: a pull request that does not change any file in doc/ or
77
# examples/ folder should be skipped unless the "[doc: build]" is found the
88
# commit message.
9-
python build_tools/circle/check_build_doc.py
10-
build_type=$?
9+
10+
get_build_type() {
11+
if [ -z "$CIRCLE_SHA1" ]
12+
then
13+
echo SKIP: undefined CIRCLE_SHA1
14+
return
15+
fi
16+
commit_msg=$(git log --format=%B -n 1 $CIRCLE_SHA1)
17+
if [ -z "$commit_msg" ]
18+
then
19+
echo QUICK BUILD: failed to inspect commit $CIRCLE_SHA1
20+
return
21+
fi
22+
if [[ "$commit_msg" =~ '.*[doc skip].*' ]]
23+
then
24+
echo SKIP: [doc skip] marker found
25+
return
26+
fi
27+
if [[ "$commit_msg" =~ '.*[doc build].*' ]]
28+
then
29+
echo BUILD: [doc build] marker found
30+
return
31+
fi
32+
if [ -z "$CI_PULL_REQUEST" ]
33+
then
34+
echo BUILD: not a pull request
35+
return
36+
fi
37+
git_range="origin/master...$CIRCLE_SHA1"
38+
git fetch origin master >&2
39+
filenames=$(git diff --name-only $git_range)
40+
if [ -z "$filenames" ]
41+
then
42+
echo QUICK BUILD: failed to get changed filenames for $git_range
43+
return
44+
fi
45+
if echo "$filenames" | grep -q -e ^examples/ -e ^doc/
46+
then
47+
echo BUILD: detected doc/ or examples/ filename modified in $git_range: $(echo "$filenames" | grep -e ^examples/ -e ^doc/ | head -n1)
48+
return
49+
fi
50+
echo QUICK BUILD: no doc/ or examples/ filename modified in $git_range:
51+
echo "$filenames"
52+
}
53+
1154
touch ~/log.txt # the "test" segment needs this file
12-
BUILD=0
13-
QUICK=1
14-
SKIP=2
15-
if [ $build_type = $SKIP ]
55+
56+
build_type=$(get_build_type)
57+
if [[ "$build_type" =~ ^SKIP ]]
1658
then
1759
exit 0
1860
fi
1961

2062
if [[ "$CIRCLE_BRANCH" =~ ^master$|^[0-9]+\.[0-9]+\.X$ && -z "$CI_PULL_REQUEST" ]]
2163
then
2264
MAKE_TARGET=dist # PDF linked into HTML
23-
elif [ $build_type = $QUICK ]
65+
elif [[ "$build_type" =~ ^QUICK ]]
2466
then
2567
MAKE_TARGET=html-noplot
2668
else

build_tools/circle/check_build_doc.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0