From df0c7cd9c06706e0c0851a42c0e1f2cdb8f656fb Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Wed, 14 Sep 2016 19:50:29 +0800 Subject: [PATCH] Add documentation ci scripts (#66) * Add documentation build to ci test * Push master branch doc changes to gh-pages branch --- .travis.yml | 10 +-- .../travis/{build.sh => build_and_test.sh} | 4 +- paddle/scripts/travis/deploy_key.enc | Bin 0 -> 1680 bytes paddle/scripts/travis/docs.sh | 63 ++++++++++++++++++ paddle/scripts/travis/main.sh | 11 +++ paddle/scripts/travis/make_install.sh | 5 -- paddle/scripts/travis/unittest.sh | 5 -- 7 files changed, 83 insertions(+), 15 deletions(-) rename paddle/scripts/travis/{build.sh => build_and_test.sh} (60%) create mode 100644 paddle/scripts/travis/deploy_key.enc create mode 100755 paddle/scripts/travis/docs.sh create mode 100755 paddle/scripts/travis/main.sh delete mode 100755 paddle/scripts/travis/make_install.sh delete mode 100755 paddle/scripts/travis/unittest.sh diff --git a/.travis.yml b/.travis.yml index a78853e15b1..d3dae9efd41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: cpp cache: ccache sudo: required dist: trusty +env: + - JOB=DOCS + - JOB=BUILD_AND_TEST addons: apt: packages: @@ -16,6 +19,7 @@ addons: - python2.7-dev - m4 - libprotobuf-dev + - doxygen - protobuf-compiler - python-protobuf - python-numpy @@ -24,12 +28,10 @@ addons: - libgflags-dev - libgtest-dev before_install: - - pip install wheel protobuf + - pip install wheel protobuf sphinx breathe recommonmark - sudo paddle/scripts/travis/before_install.sh script: - - paddle/scripts/travis/build.sh - - paddle/scripts/travis/unittest.sh - - paddle/scripts/travis/make_install.sh + - paddle/scripts/travis/main.sh notifications: email: on_success: change diff --git a/paddle/scripts/travis/build.sh b/paddle/scripts/travis/build_and_test.sh similarity index 60% rename from paddle/scripts/travis/build.sh rename to paddle/scripts/travis/build_and_test.sh index a644f2a4164..3ea633be327 100755 --- a/paddle/scripts/travis/build.sh +++ b/paddle/scripts/travis/build_and_test.sh @@ -1,5 +1,7 @@ #!/bin/bash -cd `dirname $0` source ./common.sh cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_GPU=OFF -DWITH_DOC=OFF -DWITH_TESTING=ON -DON_TRAVIS=ON make -j `nproc` +env CTEST_OUTPUT_ON_FAILURE=1 make test ARGS="-j `nproc`" +sudo make install +sudo paddle version diff --git a/paddle/scripts/travis/deploy_key.enc b/paddle/scripts/travis/deploy_key.enc new file mode 100644 index 0000000000000000000000000000000000000000..b0aa45c5ac626c735735fd8541a43bf8b099d0a0 GIT binary patch literal 1680 zcmV;B25yyUqY#1NIzV3W)fPPOg)SfJ)J5*WYWTdF5%54;p8(|fd*x$z<@A&DU_zt zThpN*QPO0+!aSC9<;RB^hjX1A&oEM;0$@rtHQxz@;%~(tgcuxer~cO>Qpn{Rn+7-b zFj(wXoxNk^UF1c0!vIFZ%8{#{AG_w!BV#y$ZpoM>TFS0UP~c_yjiN3}YrEy7m1CJd zkvb$OEPjLWhf}TiyV@DQg?3LZZc|bm1NXkyQ{C~ZrC_`<4yG7&`!KS7)!9Zr9|%U5 zWJ&Ik^}`*I``C9U#xJnkSv;Qh*R4v*jh-IJ#>QA#(Y}~4Za(4C)v8aSHfE@7l%F1C ziB@x}o(c?7Ra>u*BH8;?vm0Cka2KbkAXIw%=KV=b&!rTm~ASFMe=UDdw1p(u!uJ4a@|vRxK|%8o+wC z5EsiEVeC*W18KR9Z?B#^`#>CEsyH#~*Abv!>3W_SMUsQYJ{DU4ZrbwZnt=3@Qi=ltR*wP5nMAWWUaz5S zuaVr=+dI^jDm~2q~dgVCS5982tJrp;Sw#h!_k)my1UinflqM@WoGq3P6t!(6FM>| zegx!9TWw!?g+?75zZ+uhYNW1^|L+G9=6V*ajG9!&!Nok(g4EqEu>VO+tIC~RtHj(* zySCm`tj~1B-sh_go(`tvh4V3kC+=G1@EtLz+?x!I0H~W#sm%`;t1*tO9sh#YEHM!D zs4IgrmN-Q=4l8jIn{;sRCjX9=d@k^ejA;}KnwMZNZ65EWJee2ZX5P~ydjn&301(Zf$LY$mK- zylTPQS?#_=%{m$w*bL6`=E*CDqrlT9xk#qgIV~!N`jOC7vWzW3!zOL`Nwh9Dru{bB zI(07C%WZ6Y?MUEb#<&go$NjhUE%NlB25zp)m&;C$o~P~RpTm&0`(T_p7_@q!ID)80 zDi~n+Snf(b-|f4M4$eoC{A#vE7Z2(jz+X(3r2?@@qJPl)K%~MXx;)zd(AxIF7Kj4X z3hb3dyJ^bJoIg26DY7uisD$bklWozv73{rRdMZ64d`*eV_yNl>8d)bF>4)t*e5}m$ z*@7neNIV;I96z!?sTov23(FjGdR{C4Qz<-c=J;Z6FVMWETH4^S(wRyli5x3pF+Gnw ztp--c`pbgb5etvS&U(ZZ6~nS{UqQj>;7W87BZ3DXi;&U|Eunk$nYL`Yup25`OVkem zqP?Gd&9q!B8b-}dJt#y)#)Wb|=Q~N3(1yj9`4fY5KpAfr6oGix5Mu11S~|Kok<&E! z1`ToGlgP(SX#;M8H|aWrakI09}o>3vSb z;Fi1>16#t{5zB&7)AU)u9Ok`PWz!OW)&JepUHU#oa|26mI7GT95Dt!N3mX- z+{G+b#Lhz!yKuah&i@(8YwD8uJ;)+~G6C3oqdTE>tVyx^R ae@DhPn_m4OxNmJBUw&oN)8D0viSvK*KT_QQ literal 0 HcmV?d00001 diff --git a/paddle/scripts/travis/docs.sh b/paddle/scripts/travis/docs.sh new file mode 100755 index 00000000000..c2a4809d75b --- /dev/null +++ b/paddle/scripts/travis/docs.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Add set -e, cd to directory. +source ./common.sh + +# Compile Documentation only. +cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_GPU=OFF -DWITH_DOC=ON +make paddle_docs paddle_docs_cn + +# Parse Github URL +REPO=`git config remote.origin.url` +SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} +SHA=`git rev-parse --verify HEAD` + +# Documentation branch name +# gh-pages branch is used for PaddlePaddle.org. The English version of +# documentation in `doc` directory, and the chinese version in `doc_cn` +# directory. +TARGET_BRANCH="gh-pages" + +# Only deploy master branch to build latest documentation. +SOURCE_BRANCH="master" + +# If is not a Github pull request, and in master branch. +if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then + exit 0 +fi + +# Clone the repo to output directory +git clone $REPO output +cd output + +# checkout github page branch +git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH + +# remove old docs. mv new docs. +rm -rf doc doc_cn +mv ../doc_cn/html doc_cn +mv ../doc/html doc + +# Check is there anything changed. +set +e +git diff --exit-code >/dev/null +if [ $? -eq 0 ]; then + echo "No changes to the output on this push; exiting." + exit 0 +fi +set -e + +# Commit +git add . +git config user.name "Travis CI" +git config user.email "paddle-dev@baidu.com" +git commit -m "Deploy to GitHub Pages: ${SHA}" + +# Set ssh private key +openssl aes-256-cbc -K $SSL_KEY -iv $SSL_IV -in ../../paddle/scripts/travis/deploy_key.enc -out deploy_key -d +chmod 600 deploy_key +eval `ssh-agent -s` +ssh-add deploy_key + +# Push +git push $SSH_REPO $TARGET_BRANCH diff --git a/paddle/scripts/travis/main.sh b/paddle/scripts/travis/main.sh new file mode 100755 index 00000000000..c49d4546c24 --- /dev/null +++ b/paddle/scripts/travis/main.sh @@ -0,0 +1,11 @@ +#!/bin/bash +cd `dirname $0` + +if [ ${JOB} == "BUILD_AND_TEST" ]; then + ./build_and_test.sh +elif [ ${JOB} == "DOCS" ]; then + ./docs.sh +else + echo Unknown job ${JOB} + exit 1 +fi diff --git a/paddle/scripts/travis/make_install.sh b/paddle/scripts/travis/make_install.sh deleted file mode 100755 index 08b2a648bb9..00000000000 --- a/paddle/scripts/travis/make_install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cd `dirname $0` -source ./common.sh -sudo make install -sudo paddle version diff --git a/paddle/scripts/travis/unittest.sh b/paddle/scripts/travis/unittest.sh deleted file mode 100755 index 45e8c85c102..00000000000 --- a/paddle/scripts/travis/unittest.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cd `dirname $0` -source ./common.sh -env CTEST_OUTPUT_ON_FAILURE=1 make test ARGS="-j `nproc`" - -- GitLab