Deadlink CE #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deadlink CE | |
| on: | |
| schedule: | |
| - cron: "0 8 * * 6" # every Saturday at 16:00 | |
| workflow_dispatch: # allow to manually trigger the workflow | |
| concurrency: | |
| group: deadlink-${{ github.workflow }} | |
| cancel-in-progress: true | |
| env: | |
| COMMIT_ID: ${{ github.event.pull_request.head.sha }} | |
| TASK: PaddleFormers-CE-${{ github.event.pull_request.number }}-deadlink | |
| BRANCH: ${{ github.event.pull_request.base.ref }} | |
| CE_name: deadlink-ce | |
| no_proxy: "localhost,bj.bcebos.com,su.bcebos.com,bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn" | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| deadlink-ce: | |
| name: deadlink-ce | |
| if: github.ref == 'refs/heads/develop' | |
| runs-on: [self-hosted, paddleformers] | |
| steps: | |
| - name: Determine Image Name | |
| run: | | |
| echo "IMAGE_NAME=ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:cuda126-dev-latest" >> "$GITHUB_ENV" | |
| - name: Run Container | |
| env: | |
| work_dir: ${{ github.workspace }} | |
| FLAGS_dynamic_static_unified_comm: "True" | |
| python_version: "3.10" | |
| paddle_whl: https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuAll-LinuxCentos-Gcc11-Cuda126-Cudnn95-Trt105-Py310-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl | |
| run: | | |
| container_name=${TASK}-$(date +%Y%m%d-%H%M%S) | |
| echo "container_name=${container_name}" >> "$GITHUB_ENV" | |
| DOCKER_VER=$(docker version --format '{{.Server.Version}}' | cut -d. -f1,2) | |
| if (( $(echo "$DOCKER_VER < 19.03" | bc -l) )); then | |
| GPU_OPTION="--runtime=nvidia" | |
| else | |
| GPU_OPTION="--gpus all" | |
| fi | |
| echo "DOCKER_VER=${DOCKER_VER}" | |
| echo "GPU_OPTION=${GPU_OPTION}" | |
| docker run -d -t ${GPU_OPTION} --name ${container_name} --net=host -v /dev/shm:/dev/shm --shm-size=32G \ | |
| -v $work_dir/../../..:$work_dir/../../.. \ | |
| -v $work_dir:/workspace \ | |
| -v /home/.cache/pip:/home/.cache/pip \ | |
| -e BRANCH \ | |
| -e COMMIT_ID \ | |
| -e work_dir \ | |
| -e ce_scripts \ | |
| -e no_proxy \ | |
| -e CE_name \ | |
| -e paddle_whl \ | |
| -e FLAGS_dynamic_static_unified_comm \ | |
| -e python_version \ | |
| -w /workspace --privileged $IMAGE_NAME | |
| - name: Download Code | |
| run: | | |
| docker exec -t $container_name /bin/bash -c ' | |
| rm -rf * .[^.]* | |
| echo "Downloading PaddleFormers.tar" | |
| wget -q --no-proxy https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddleFormers.tar --no-check-certificate | |
| echo "Extracting PaddleFormers.tar" | |
| tar xf PaddleFormers.tar && rm -rf PaddleFormers.tar | |
| source $work_dir/../../../proxy | |
| cd PaddleFormers | |
| git config --global user.name "PaddleCE" | |
| git config --global user.email "paddle_ce@example.com" | |
| git pull | |
| git submodule update --init --recursive --force | |
| git log --pretty=oneline -10 | |
| cd - | |
| echo "Downloading PaddleTest.tar" | |
| wget -q --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleTest.tar.gz --no-check-certificate | |
| tar xf PaddleTest.tar.gz | |
| cp -r PaddleTest/models/PaddleNLP/deadlink/* ./ | |
| ' | |
| - name: Test | |
| run: | | |
| docker exec -t $container_name /bin/bash -c ' | |
| ldconfig | |
| pip config set global.cache-dir "/home/.cache/pip" | |
| set -e | |
| python -m pip install beautifulsoup4 openpyxl | |
| source $work_dir/../../../proxy | |
| bash run.sh PaddleFormers develop liujie44@baidu.com "PaddleFormers Broken Link Check Summary Report" | |
| ' | |
| - name: Upload Logs | |
| if: always() | |
| env: | |
| home_path: ${{ github.workspace }}/../../.. | |
| bos_file: ${{ github.workspace }}/../../../bos/BosClient.py | |
| run: | | |
| docker exec -t $container_name /bin/bash -c ' | |
| if [ ! -f "${{ env.bos_file }}" ]; then | |
| wget -q --no-proxy -O ${{ env.home_path }}/bos_new.tar.gz https://xly-devops.bj.bcebos.com/home/bos_new.tar.gz --no-check-certificate | |
| mkdir ${{ env.home_path }}/bos | |
| tar xf ${{ env.home_path }}/bos_new.tar.gz -C ${{ env.home_path }}/bos | |
| fi | |
| bos_prefix="schedule/$(date +%Y%m%d)" | |
| cd /workspace/result | |
| for FILE in /workspace/result/*; do | |
| file=$(basename "$FILE") | |
| python ${{ env.bos_file }} $file paddle-github-action/PR/PaddleFormers/deadlink/${bos_prefix}/logs | |
| echo "$file: https://paddle-github-action.bj.bcebos.com/PR/PaddleFormers/deadlink/${bos_prefix}/logs/$file" | |
| done | |
| ' | |
| - name: Terminate And Delete the Container | |
| if: always() | |
| run: | | |
| docker rm -f $container_name 2>/dev/null || true |