add CI gpu test case (#15669)

* Create test_gpu.yml

* Update test_gpu.yml

* Create test.py

* Update test_gpu.yml

* Delete configs/test.py

* Update test_gpu.yml

* Create test.py

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Update test_gpu.yml

* Delete .github/workflows/test.py
This commit is contained in:
plusNew001 2025-06-11 15:37:48 +08:00 committed by GitHub
parent 1ebf2e46ed
commit 25fffadc2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

108
.github/workflows/test_gpu.yml vendored Normal file
View File

@ -0,0 +1,108 @@
name: PaddleOCR PR Tests GPU
on:
push:
branches: ["main"]
paths-ignore:
- '**.md'
- '**.txt'
- '**.yml'
- '**.yaml'
pull_request:
branches: ["main"]
paths-ignore:
- '**.md'
- '**.txt'
- '**.yml'
- '**.yaml'
workflow_dispatch:
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
work_dir: /workspace/PaddleOCR
PADDLENLP_ROOT: /workspace/PaddleOCR
TASK: paddleocr-CI-${{ github.event.pull_request.number }}
BRANCH: ${{ github.event.pull_request.base.ref }}
AGILE_COMPILE_BRANCH: ${{ github.event.pull_request.base.ref }}
DIR_NAME: ${{ github.repository }}
permissions:
contents: read
jobs:
tar2cloud:
environment: CodeSync
runs-on: ubuntu-latest
steps:
- name: clone and fetch
run: |
git clone https://github.com/PaddlePaddle/PaddleOCR.git
cd PaddleOCR
git fetch origin pull/${PR_ID}/head:ci_build
git checkout ci_build
cd ../
tar cf PaddleOCR.tar PaddleOCR
- name: Upload
env:
AK: ${{ secrets.BOS_AK }}
SK: ${{ secrets.BOS_SK }}
run: |
python -m pip install bce-python-sdk==0.8.74
wget -q --no-proxy https://xly-devops.bj.bcebos.com/home/bos_new.tar.gz
tar xf bos_new.tar.gz
ls
python BosClient.py PaddleOCR.tar paddle-qa/PaddleOCR/pr/${PR_ID}
test-pr:
needs: tar2cloud
runs-on: self-hosted
steps:
- name: check env
run: |
echo ${PR_ID}
echo ${COMMIT_ID}
echo ${TASK}
echo ${BRANCH}
echo ${AGILE_COMPILE_BRANCH}
echo ${DIR_NAME}
- name: get code
run: |
wget -q https://paddle-qa.bj.bcebos.com/PaddleOCR/pr/${PR_ID}/PaddleOCR.tar
tar xf PaddleOCR.tar
cd PaddleOCR
git log
- name: run test
env:
py_version: "3.10"
paddle_whl: https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuSome-LinuxCentos-Gcc82-Cuda118-Cudnn86-Trt85-Py310-CINN-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:latest-dev-cuda11.8-cudnn8.6-trt8.5-gcc82
run: |
cd PaddleOCR
docker run --gpus all --rm -i --name PaddleOCR_CI_$RANDOM \
--shm-size=128g --net=host \
-v $PWD:/workspace -w /workspace \
-e "py_version=${py_version}" \
-e "paddle_whl=${paddle_whl}" \
${docker_image} /bin/bash -c '
ldconfig;
nvidia-smi
df -hl
echo ${py_version}
rm -rf run_env
mkdir run_env
ln -s $(which python${py_version}) run_env/python
ln -s $(which python${py_version}) run_env/python3
ln -s $(which pip${py_version}) run_env/pip
export PATH=$PWD/run_env:${PATH}
python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
python -c "import paddle; paddle.version.show()"
python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python -m pip install pytest
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
python -m pip install -e .
python -m pytest --verbose tests/
'