PaddlePaddle/PaddleOCR

9 workflows · maturity 50% · 4 patterns · GitHub ↗

Security 13.89/100

Practices

✓ Matrix✓ Permissions○ Security scan○ AI review✓ Cache○ Concurrency○ Reusable workflows

Detected patterns

Security dimensions

permissions
13.9
security scan
0
supply chain
0
secret handling
0
harden runner
0

Workflows (9)

build_publish_develop_docs perms .github/workflows/build_publish_develop_docs.yml
Triggers
push
Runs on
ubuntu-latest
Jobs
deploy
Commands
  • git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com
  • echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
  • pip install mike mkdocs-material jieba mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-static-i18n markdown-callouts
  • git fetch origin gh-pages --depth=1 mike deploy --push --update-aliases main latest
View raw YAML
name: Build/Publish Develop Docs
on:
  push:
    branches:
      - master
      - main
permissions:
  contents: write
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Configure Git Credentials
        run: |
          git config user.name github-actions[bot]
          git config user.email 41898282+github-actions[bot]@users.noreply.github.com
      - uses: actions/setup-python@v6
        with:
          python-version: 3.x
      - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
      - uses: actions/cache@v5
        with:
          key: mkdocs-material-${{ env.cache_id }}
          path: .cache
          restore-keys: |
            mkdocs-material-
      - run: pip install mike mkdocs-material jieba mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-static-i18n markdown-callouts
      - run: |
          git fetch origin gh-pages --depth=1
          mike deploy --push --update-aliases main latest
build_publish_release_docs perms .github/workflows/build_publish_release_docs.yml
Triggers
push
Runs on
ubuntu-latest
Jobs
deploy
Commands
  • git config user.name github-actions[bot] git config user.email github-actions[bot]@users.noreply.github.com
  • echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
  • pip install mike mkdocs-material jieba mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-static-i18n markdown-callouts
  • git fetch origin gh-pages --depth=1 mike deploy --push "${{ github.ref_name }}"
View raw YAML
name: Build/Publish Release Docs
on:
  push:
    tags:
      - v*

permissions:
  contents: write
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Configure Git Credentials
        run: |
          git config user.name github-actions[bot]
          git config user.email github-actions[bot]@users.noreply.github.com
      - uses: actions/setup-python@v6
        with:
          python-version: 3.x
      - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
      - uses: actions/cache@v5
        with:
          key: mkdocs-material-${{ env.cache_id }}
          path: .cache
          restore-keys: |
            mkdocs-material-
      - run: pip install mike mkdocs-material jieba mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-static-i18n markdown-callouts
      - run: |
          git fetch origin gh-pages --depth=1
          mike deploy --push "${{ github.ref_name }}"
close_inactive_issues .github/workflows/close_inactive_issues.yaml
Triggers
schedule
Runs on
ubuntu-latest
Jobs
close-issues
Actions
actions/stale
View raw YAML
name: Close inactive issues
on:
  schedule:
    - cron: "30 1 * * *"

jobs:
  close-issues:
    runs-on: ubuntu-latest
    permissions:
      issues: write
      pull-requests: write
    steps:
      - uses: actions/stale@v10
        with:
          days-before-issue-stale: 90
          days-before-issue-close: 14
          stale-issue-label: "stale"
          stale-issue-message: "This issue is stale because it has been open for 90 days with no activity."
          close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
          days-before-pr-stale: -1
          days-before-pr-close: -1
          repo-token: ${{ secrets.GITHUB_TOKEN }}
    
codestyle .github/workflows/codestyle.yml
Triggers
pull_request, push
Runs on
ubuntu-latest
Jobs
check-code-style
Actions
pre-commit/action
Commands
  • python -m pip install --upgrade pip pip install "clang-format==13.0.0"
View raw YAML
name: PaddleOCR Code Style Check

on:
  pull_request:
  push:
    branches: ['main', 'release/*']

jobs:
  check-code-style:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6
      with:
        ref: ${{ github.ref }}

    - uses: actions/setup-python@v6
      with:
        python-version: '3.10'

    - name: Cache Python dependencies
      uses: actions/cache@v5
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
        restore-keys: |
          ${{ runner.os }}-pip-

    - name: Install Dependencies for Python
      run: |
        python -m pip install --upgrade pip
        pip install "clang-format==13.0.0"

    - uses: pre-commit/action@v3.0.1
      with:
        extra_args: '--all-files'
docs-anchor-check .github/workflows/docs-anchor-check.yml
Triggers
pull_request
Runs on
ubuntu-latest
Jobs
check-anchor-links
Commands
  • pip install mike mkdocs-material jieba mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-static-i18n markdown-callouts
  • mkdocs build -f mkdocs-ci.yml
View raw YAML
name: Docs Anchor Link Check

on:
  pull_request:
    paths:
      - 'docs/**'
      - 'mkdocs.yml'
      - 'mkdocs-ci.yml'
      - 'overrides/**'

jobs:
  check-anchor-links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 1

      - uses: actions/setup-python@v6
        with:
          python-version: '3.x'

      - uses: actions/cache@v5
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-mkdocs-${{ hashFiles('mkdocs.yml') }}
          restore-keys: |
            ${{ runner.os }}-pip-mkdocs-

      - name: Install dependencies
        run: pip install mike mkdocs-material jieba mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-static-i18n markdown-callouts

      - name: Check for broken anchor links
        env:
          ENABLE_GIT_PLUGINS: 'false'
        run: mkdocs build -f mkdocs-ci.yml
link-check .github/workflows/link-check.yml
Triggers
repository_dispatch, push, workflow_dispatch, schedule
Runs on
ubuntu-latest
Jobs
linkChecker
Actions
lycheeverse/lychee-action, peter-evans/create-issue-from-file
View raw YAML
name: Link Checker

on:
  repository_dispatch:
  push:
    branches:
      - main
  workflow_dispatch:
  schedule:
    - cron: "00 18 * * 6"

jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Link Checker
        id: lychee
        uses: lycheeverse/lychee-action@v2
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
        with:
            args: --exclude 'docs/index/*.md' 'docs/update/*.md' --verbose --no-progress --max-redirects 8 'docs/**/*.md'
            format: markdown
            fail: false
            output: lychee/results.md

      - name: Create Issue From File
        if: steps.lychee.outputs.exit_code != 0
        uses: peter-evans/create-issue-from-file@v6
        with:
          title: Link Checker Report
          content-filepath: ./lychee/results.md
          labels: report, automated issue
python-publish perms .github/workflows/python-publish.yml
Triggers
release
Runs on
ubuntu-latest
Jobs
deploy
Actions
pypa/gh-action-pypi-publish
Commands
  • python -m pip install --upgrade pip pip install build==1.2.2
  • python -m build
View raw YAML
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
  release:
    types: [published]

permissions:
  contents: read

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6
    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: '3.x'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install build==1.2.2
    - name: Build package
      run: python -m build
    - name: Publish package
      uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e  # v1.13.0
      with:
        user: __token__
        password: ${{ secrets.PYPI_API_TOKEN }}
test_gpu perms .github/workflows/test_gpu.yml
Triggers
push, pull_request, workflow_dispatch
Runs on
ubuntu-latest, self-hosted, GPU-2Card-OCR
Jobs
detect-changes, test-pr-gpu
Actions
dorny/paths-filter
Commands
  • work_dir=$RANDOM mkdir $work_dir cd $work_dir git clone --depth=1 https://github.com/PaddlePaddle/PaddleOCR.git -b main cd PaddleOCR git fetch origin pull/${PR_ID}/head:ci_build git checkout ci_build 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.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 python -m pip install -e ".[all]" python -m pytest --verbose tests/ '
View raw 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 }}
  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.filter.outputs.docs_only }}
    steps:
      - uses: actions/checkout@v6
      - id: filter
        uses: dorny/paths-filter@v3
        with:
          filters: |
            docs_only:
              - '**.md'
              - '**.txt'
              - '**.yml'
              - '**.yaml'

  test-pr-gpu:
    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
          git fetch origin pull/${PR_ID}/head:ci_build
          git checkout ci_build
          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.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
            python -m pip install -e ".[all]"
            python -m pytest --verbose tests/
            '
tests matrix perms .github/workflows/tests.yaml
Triggers
push, pull_request
Runs on
ubuntu-latest, ubuntu-latest
Jobs
detect-changes, test-pr
Matrix
python-version→ 3.13, 3.8, 3.9
Actions
dorny/paths-filter
Commands
  • python -m pip install --upgrade pip pip install pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [[ "${{ matrix.python-version }}" == "3.8" ]]; then python -m pip install paddlepaddle==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ else python -m pip install paddlepaddle==3.3.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ fi python -m pip install -e '.[all]' 'paddlex@git+https://github.com/PaddlePaddle/PaddleX.git@develop'
  • pytest --verbose tests/
View raw YAML
name: PaddleOCR PR Tests

on:
  push:
    branches: ["main", "release/*"]
  pull_request:
    branches: ["main", "release/*"]
    paths-ignore:


permissions:
  contents: read

jobs:
  detect-changes:
    runs-on: ubuntu-latest
    outputs:
      docs_only: ${{ steps.filter.outputs.docs_only }}
    steps:
      - uses: actions/checkout@v6
      - id: filter
        uses: dorny/paths-filter@v3
        with:
          filters: |
            docs_only:
              - '**.md'
              - '**.txt'
              - '**.yml'
              - '**.yaml'

  test-pr:
    runs-on: ubuntu-latest
    needs: detect-changes
    if: needs.detect-changes.outputs.docs_only != 'true'
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.13"]

    steps:
    - uses: actions/checkout@v6
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}

    - name: Cache dependencies
      uses: actions/cache@v5
      with:
        path: |
          ~/.cache/pip
          ~/.local/lib/python${{ matrix.python-version }}/site-packages
          ~/.paddleocr/
        key: ${{ runner.os }}-dependencies-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt', 'pyproject.toml') }}
        restore-keys: |
          ${{ runner.os }}-dependencies-

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pytest
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
        if [[ "${{ matrix.python-version }}" == "3.8" ]]; then
          python -m pip install paddlepaddle==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
        else
          python -m pip install paddlepaddle==3.3.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
        fi
        python -m pip install -e '.[all]' 'paddlex@git+https://github.com/PaddlePaddle/PaddleX.git@develop'
    - name: Test with pytest
      run: |
        pytest --verbose tests/