Files
wehub-resource-sync e904b667c6
PaddleOCR PR Tests GPU / test-pr-gpu (push) Blocked by required conditions
PaddleOCR PR Tests / test-pr (push) Blocked by required conditions
PaddleOCR PR Tests / test-pr-python (3.8) (push) Waiting to run
Build/Publish Develop Docs / deploy (push) Failing after 1s
PaddleOCR Code Style Check / check-code-style (push) Failing after 1s
PaddleOCR PR Tests GPU / detect-changes (push) Failing after 1s
PaddleOCR PR Tests GPU / test-pr-gpu-impl (push) Waiting to run
PaddleOCR PR Tests / detect-changes (push) Failing after 1s
PaddleOCR PR Tests / test-pr-python (3.13) (push) Waiting to run
PaddleOCR PR Tests / test-pr-python (3.9) (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 11:59:26 +08:00

118 lines
4.7 KiB
YAML

name: PaddleOCR PR Tests GPU
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha || github.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:
detect-changes:
runs-on: ubuntu-latest
outputs:
docs_only: ${{ steps.detect.outputs.docs_only }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- id: detect
uses: ./.github/actions/detect-docs-only
test-pr-gpu-impl:
runs-on: [self-hosted, GPU-2Card-OCR]
needs: detect-changes
if: needs.detect-changes.outputs.docs_only != 'true'
steps:
- 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: |
work_dir=$RANDOM
mkdir $work_dir
cd $work_dir
git clone --depth=1 https://github.com/PaddlePaddle/PaddleOCR.git -b main
cd PaddleOCR
if [ -n "${PR_ID}" ]; then
git fetch origin pull/${PR_ID}/head:ci_build
git checkout ci_build
else
git fetch --depth=1 origin "${COMMIT_ID}"
git checkout "${COMMIT_ID}"
fi
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}
git config --global --add safe.directory /workspace
python -m pip install paddlepaddle-gpu==3.1.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
PADDLEX_SERIES=$(grep -oE "paddlex\[[^]]+\]>=[0-9]+\.[0-9]+" pyproject.toml | head -1 | grep -oE "[0-9]+\.[0-9]+")
if [ -z "$PADDLEX_SERIES" ]; then
echo "Failed to determine PaddleX version requirement from pyproject.toml" >&2
exit 1
fi
PADDLEX_BRANCH="release/${PADDLEX_SERIES}"
echo "Installing PaddleX from branch: ${PADDLEX_BRANCH}"
python -m pip install -e ".[all]" "paddlex@git+https://github.com/PaddlePaddle/PaddleX.git@${PADDLEX_BRANCH}"
python -c "import paddlex; print(f\"Installed paddlex version: {paddlex.__version__}\")"
python -m pytest --verbose tests/
'
# Aggregator: produces a single check named `test-pr-gpu` so branch
# protection (which requires the literal context `test-pr-gpu`) is satisfied
# even when the heavy GPU job is skipped (e.g. docs-only changes). Without
# this, a SKIPPED conclusion on the GPU job leaves the required check
# unsatisfied and blocks merge.
test-pr-gpu:
runs-on: ubuntu-latest
needs: [detect-changes, test-pr-gpu-impl]
if: always()
steps:
- name: Verify required jobs
run: |
if [ "${{ needs.detect-changes.result }}" != "success" ]; then
echo "detect-changes did not succeed: ${{ needs.detect-changes.result }}"
exit 1
fi
if [ "${{ needs.detect-changes.outputs.docs_only }}" = "true" ]; then
echo "Docs-only change; treating GPU tests as not required."
exit 0
fi
if [ "${{ needs.test-pr-gpu-impl.result }}" != "success" ]; then
echo "test-pr-gpu-impl concluded with: ${{ needs.test-pr-gpu-impl.result }}"
exit 1
fi
echo "GPU tests passed."