|  | 
|  | 1 | +name: Model-benchmark | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | + workflow_call: | 
|  | 5 | + inputs: | 
|  | 6 | + docker_doc_image: | 
|  | 7 | + type: string | 
|  | 8 | + required: true | 
|  | 9 | + can-skip: | 
|  | 10 | + type: string | 
|  | 11 | + required: false | 
|  | 12 | + | 
|  | 13 | +env: | 
|  | 14 | + PR_ID: ${{ github.event.pull_request.number }} | 
|  | 15 | + COMMIT_ID: ${{ github.event.pull_request.head.sha }} | 
|  | 16 | + ci_scripts: /workspace/paddle/ci | 
|  | 17 | + BRANCH: ${{ github.event.pull_request.base.ref }} | 
|  | 18 | + TASK: paddle-CI-${{ github.event.pull_request.number }}-Doc-Preview | 
|  | 19 | + CI_name: Doc-Preview | 
|  | 20 | + no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn" | 
|  | 21 | + | 
|  | 22 | +defaults: | 
|  | 23 | + run: | 
|  | 24 | + shell: bash | 
|  | 25 | + | 
|  | 26 | +jobs: | 
|  | 27 | + check-bypass: | 
|  | 28 | + name: Check bypass for Doc-Preview | 
|  | 29 | + uses: ./.github/workflows/check-bypass.yml | 
|  | 30 | + with: | 
|  | 31 | + workflow-name: 'Doc-Preview' | 
|  | 32 | + secrets: | 
|  | 33 | + github-token: ${{ secrets.GITHUB_TOKEN }} | 
|  | 34 | + | 
|  | 35 | + build-doc: | 
|  | 36 | + name: Build doc | 
|  | 37 | + runs-on: | 
|  | 38 | + group: BD_BJ-V100 | 
|  | 39 | + steps: | 
|  | 40 | + - name: Check docker image and run container | 
|  | 41 | + env: | 
|  | 42 | + AGILE_PULL_ID: ${{ github.event.pull_request.number }} | 
|  | 43 | + AGILE_REVISION: ${{ github.event.pull_request.head.sha }} | 
|  | 44 | + BUILD_DOC: "true" | 
|  | 45 | + UPLOAD_DOC: "true" | 
|  | 46 | + BOSBUCKET: "paddle-site-web-dev" | 
|  | 47 | + PREVIEW_SITE: "paddle-docs-preview.paddlepaddle.org.cn" | 
|  | 48 | + AGILE_COMPILE_BRANCH: ${{ github.event.pull_request.base.ref }} | 
|  | 49 | + BOS_CREDENTIAL_AK: "paddle" | 
|  | 50 | + BOS_CREDENTIAL_SK: "paddle" | 
|  | 51 | + run: | | 
|  | 52 | + container_name=${TASK}-$(date +%Y%m%d-%H%M%S) | 
|  | 53 | + echo "container_name=${container_name}" >> ${{ github.env }} | 
|  | 54 | + docker_image=${{ inputs.docker_doc_image }} | 
|  | 55 | + docker run -d -t --name ${container_name} \ | 
|  | 56 | + -v "/home/data/cfs:/home/data/cfs" \ | 
|  | 57 | + -v "/home/data/cfs/.cache/python35-cpu:/root/.cache" \ | 
|  | 58 | + -v "/home/data/cfs/.ccache:/root/.ccache" \ | 
|  | 59 | + -v "/dev/shm:/dev/shm" \ | 
|  | 60 | + -v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \ | 
|  | 61 | + -v ${{ github.workspace }}:/paddle \ | 
|  | 62 | + -e AGILE_PULL_ID \ | 
|  | 63 | + -e AGILE_REVISION \ | 
|  | 64 | + -e BUILD_DOC \ | 
|  | 65 | + -e UPLOAD_DOC \ | 
|  | 66 | + -e BOSBUCKET \ | 
|  | 67 | + -e PREVIEW_SITE \ | 
|  | 68 | + -e BRANCH \ | 
|  | 69 | + -e AGILE_COMPILE_BRANCH \ | 
|  | 70 | + -e BOS_CREDENTIAL_AK \ | 
|  | 71 | + -e BOS_CREDENTIAL_SK \ | 
|  | 72 | + -e no_proxy \ | 
|  | 73 | + -w /paddle --network host ${docker_image} | 
|  | 74 | +
 | 
|  | 75 | + - name: Doc build | 
|  | 76 | + run: | | 
|  | 77 | + docker exec -t ${{ env.container_name }} /bin/bash -c ' | 
|  | 78 | + rm -rf * .[^.]* | 
|  | 79 | + wget -q https://xly-devops.bj.bcebos.com/PR/build_whl/${AGILE_PULL_ID}/${AGILE_REVISION}/build.tar.gz | 
|  | 80 | + tar --use-compress-program="pigz -1" -xpf build.tar.gz | 
|  | 81 | + cd ./paddle | 
|  | 82 | + api_doc_spec_diff=$(python tools/diff_api.py paddle/fluid/API_DEV.spec.doc paddle/fluid/API_PR.spec.doc) | 
|  | 83 | + if [ "$api_doc_spec_diff" == "" ]; then | 
|  | 84 | + echo "API documents no change." | 
|  | 85 | + exit 0 | 
|  | 86 | + fi | 
|  | 87 | +
 | 
|  | 88 | + curl -sS -o /tmp/entrypoint.sh https://paddle-dev-tools-open.bj.bcebos.com/fluiddoc-preview/entrypoint-paddle-docs-review.sh | 
|  | 89 | + cd / | 
|  | 90 | + source ${{ github.workspace }}/../../../proxy | 
|  | 91 | + bash "/tmp/entrypoint.sh" | 
|  | 92 | + ' | 
|  | 93 | +
 | 
|  | 94 | + - name: Terminate and delete the container | 
|  | 95 | + if: always() | 
|  | 96 | + run: | | 
|  | 97 | + docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*' | 
|  | 98 | + docker rm -f ${{ env.container_name }} | 
0 commit comments