Skip to content

Commit 95d2651

Browse files
authored
Build: simplify travis CI script. (#10245)
* Build: simplify travis CI script. * Add linkcheck and run gen_doc in host machine not in docker. * Add LinkCheck python package.
1 parent 32372c0 commit 95d2651

File tree

4 files changed

+33
-35
lines changed

4 files changed

+33
-35
lines changed

.travis.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
os:
1313
- linux
1414
env:
15-
- JOB=build_doc
15+
- JOB=doc
1616
- JOB=check_style
1717
- JOB=build_android
1818
addons:
@@ -36,21 +36,20 @@ addons:
3636
- ccache
3737
ssh_known_hosts: 13.229.163.131
3838
before_install:
39-
- if [[ "$JOB" == "check_style" ]]; then sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format; fi
40-
# Paddle is using protobuf 3.1 currently. Protobuf 3.2 breaks the compatibility. So we specify the python
41-
# protobuf version.
42-
- sudo pip install -r $TRAVIS_BUILD_DIR/python/requirements.txt
43-
- sudo pip install wheel sphinx==1.5.6 recommonmark sphinx-rtd-theme==0.1.9 virtualenv pre-commit LinkChecker
4439
- |
4540
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
4641
script:
4742
- |
4843
# 43min timeout
49-
if [[ "$JOB" == "build_android" ]]; then timeout 2580 docker run -it --rm -v "$TRAVIS_BUILD_DIR:/paddle" paddlepaddle/paddle:latest-dev-android;
50-
else timeout 2580 paddle/scripts/travis/${JOB}.sh; fi;
51-
RESULT=$?; if [ $RESULT -eq 0 ] || [ $RESULT -eq 142 ]; then true; else exit 1; fi;
44+
if [[ "$JOB" != "doc" ]]; then
45+
timeout 2580 paddle/scripts/paddle_docker_build.sh ${JOB}
46+
else
47+
timeout 2580 paddle/scritps/paddle_build.sh doc
48+
fi
49+
if [ $? -eq 0 ] || [ $? -eq 142 ]; then true; else exit 1; fi;
5250
- |
53-
if [[ "$JOB" != "build_doc" ]]; then exit 0; fi;
51+
if [[ "$JOB" != "doc" ]]; then exit 0; fi;
52+
# For document only
5453
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
5554
if [[ "$TRAVIS_BRANCH" != "develop" && ! "$TRAVIS_BRANCH" =~ ^v[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then exit 0; fi;
5655
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh

paddle/scripts/paddle_build.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ EOF
208208
--platform=android-$ANDROID_API \
209209
--install-dir=$ANDROID_STANDALONE_TOOLCHAIN
210210

211-
BUILD_ROOT=${PADDLE_ROOT}/build
212-
DEST_ROOT={PADDLE_ROOT}/install
211+
BUILD_ROOT=${PADDLE_ROOT}/build_android
212+
DEST_ROOT=${PADDLE_ROOT}/install_android
213213

214214
mkdir -p $BUILD_ROOT
215215
cd $BUILD_ROOT
@@ -349,13 +349,18 @@ function gen_docs() {
349349
========================================
350350
EOF
351351
cmake .. \
352+
-DCMAKE_BUILD_TYPE=Release \
352353
-DWITH_DOC=ON \
353354
-DWITH_GPU=OFF \
354-
-DWITH_AVX=${WITH_AVX:-ON} \
355-
-DWITH_SWIG_PY=ON \
355+
-DWITH_MKL=OFF \
356356
-DWITH_STYLE_CHECK=OFF
357357

358358
make -j `nproc` paddle_docs paddle_apis
359+
360+
# check websites for broken links
361+
linkchecker doc/v2/en/html/index.html
362+
linkchecker doc/v2/cn/html/index.html
363+
linkchecker doc/v2/api/en/html/index.html
359364
}
360365

361366
function gen_html() {

paddle/scripts/paddle_docker_build.sh

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ function start_build_docker() {
2828
docker rm -f "${CONTAINER_ID}" 1>/dev/null
2929
fi
3030

31+
apt_mirror='s#http://archive.ubuntu.com/ubuntu#mirror://mirrors.ubuntu.com/mirrors.txt#g'
3132
DOCKER_ENV=$(cat <<EOL
3233
-e FLAGS_fraction_of_gpu_memory_to_use=0.15 \
3334
-e CTEST_OUTPUT_ON_FAILURE=1 \
3435
-e CTEST_PARALLEL_LEVEL=5 \
36+
-e APT_MIRROR=${apt_mirror} \
3537
-e WITH_GPU=ON \
38+
-e CUDA_ARCH_NAME=Auto \
39+
-e WITH_AVX=ON \
40+
-e WITH_GOLANG=OFF \
3641
-e WITH_TESTING=ON \
3742
-e WITH_C_API=OFF \
3843
-e WITH_COVERAGE=ON \
@@ -42,18 +47,23 @@ function start_build_docker() {
4247
-e PADDLE_FRACTION_GPU_MEMORY_TO_USE=0.15 \
4348
-e CUDA_VISIBLE_DEVICES=0,1 \
4449
-e WITH_DISTRIBUTE=ON \
50+
-e WITH_FLUID_ONLY=ON \
4551
-e RUN_TEST=ON
4652
EOL
4753
)
54+
55+
DOCKER_CMD="nvidia-docker"
56+
if ! [ -x "$(command -v ${DOCKER_CMD})" ]; then
57+
DOCKER_CMD="docker"
58+
fi
4859
set -x
49-
nvidia-docker run -it \
50-
-d \
60+
${DOCKER_CMD} run -it \
5161
--name $CONTAINER_ID \
5262
${DOCKER_ENV} \
5363
-v $PADDLE_ROOT:/paddle \
5464
-w /paddle \
5565
$IMG \
56-
/bin/bash
66+
paddle/scripts/paddle_build.sh $@
5767
set +x
5868
}
5969

@@ -67,24 +77,7 @@ function main() {
6777
VERSION="latest-dev-android"
6878
fi
6979
IMG=${DOCKER_REPO}:${VERSION}
70-
71-
case $1 in
72-
start)
73-
start_build_docker
74-
;;
75-
build_android)
76-
start_build_docker
77-
docker exec ${CONTAINER_ID} bash -c "./paddle/scripts/paddle_build.sh $@"
78-
;;
79-
*)
80-
if container_running "${CONTAINER_ID}"; then
81-
docker exec ${CONTAINER_ID} bash -c "./paddle/scripts/paddle_build.sh $@"
82-
else
83-
echo "Please start container first, with command:"
84-
echo "$0 start"
85-
fi
86-
;;
87-
esac
80+
start_build_docker $@
8881
}
8982

9083
main $@

python/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ scipy>=0.19.0
88
Pillow
99
nltk>=3.2.2
1010
graphviz
11+
LinkChecker

0 commit comments

Comments
 (0)