name: pr_stage_test

on:
  pull_request:
    paths-ignore:
      - 'README.md'
      - 'README_zh-CN.md'
      - 'docs/**'
      - 'demo/**'
      - '.dev_scripts/**'
      - '.circleci/**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

# jobs:
#   build_cpu:
#     runs-on: ubuntu-18.04
#     strategy:
#       matrix:
#         python-version: [3.7]
#         include:
#           - torch: 1.8.1
#             torchvision: 0.9.1
#     steps:
#       - uses: actions/checkout@v2
#       - name: Set up Python ${{ matrix.python-version }}
#         uses: actions/setup-python@v2
#         with:
#           python-version: ${{ matrix.python-version }}
#       - name: Upgrade pip
#         run: pip install pip --upgrade
#       - name: Get MMCV_TORCH as the environment variable
#         run: . .github/workflows/scripts/get_mmcv_var.sh ${{matrix.torch}}
#         shell: bash
#       - name: Install PyTorch
#         run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
#       - name: Install MMCV
#         run: pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch${MMCV_TORCH}/index.html
#       - name: Install MMDet
#         run: pip install mmdet
#       - name: Install other dependencies
#         run: pip install -r requirements.txt
#       - name: Build and install
#         run: rm -rf .eggs && pip install -e .
#       - name: Run unittests and generate coverage report
#         run: |
#           coverage run --branch --source mmocr -m pytest tests/
#           coverage xml
#           coverage report -m
#       # Upload coverage report for python3.7 && pytorch1.8.1 cpu
#       - name: Upload coverage to Codecov
#         uses: codecov/codecov-action@v1.0.14
#         with:
#           file: ./coverage.xml
#           flags: unittests
#           env_vars: OS,PYTHON
#           name: codecov-umbrella
#           fail_ci_if_error: false

#   build_cu102:
#     runs-on: ubuntu-18.04
#     container:
#       image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
#     strategy:
#       matrix:
#         python-version: [3.7]
#     steps:
#       - uses: actions/checkout@v2
#       - name: Set up Python ${{ matrix.python-version }}
#         uses: actions/setup-python@v2
#         with:
#           python-version: ${{ matrix.python-version }}
#       - name: Upgrade pip
#         run: python -m pip install pip --upgrade
#       - name: Fetch GPG keys
#         run: |
#           apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
#           apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
#       - name: Get MMCV_TORCH and MMCV_CUDA as environment variables
#         run: . .github/workflows/scripts/get_mmcv_var.sh ${{matrix.torch}} ${{matrix.cuda}}
#         shell: bash
#       - name: Install Python-dev
#         run: apt-get update && apt-get install -y python${{matrix.python-version}}-dev
#         if: ${{matrix.python-version != 3.9}}
#       - name: Install system dependencies
#         run: |
#           apt-get update
#           apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev
#       - name: Install mmocr dependencies
#         run: |
#           python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/${MMCV_CUDA}/torch${MMCV_TORCH}/index.html
#           python -m pip install mmdet
#           python -m pip install -r requirements.txt
#       - name: Build and install
#         run: |
#           python setup.py check -m -s
#           TORCH_CUDA_ARCH_LIST=7.0 python -m pip install -e .

#   build_windows:
#     runs-on: ${{ matrix.os }}
#     strategy:
#       matrix:
#         os: [windows-2022]
#         python: [3.7]
#         platform: [cpu, cu102]
#     steps:
#       - uses: actions/checkout@v2
#       - name: Set up Python ${{ matrix.python-version }}
#         uses: actions/setup-python@v2
#         with:
#           python-version: ${{ matrix.python-version }}
#       - name: Upgrade pip
#         run: python -m pip install pip --upgrade
#       - name: Install lmdb
#         run: python -m pip install lmdb
#       - name: Install PyTorch
#         run: python -m pip install torch==1.8.1+${{matrix.platform}} torchvision==0.9.1+${{matrix.platform}} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
#       - name: Install mmocr dependencies
#         run: |
#           python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8/index.html --only-binary mmcv-full
#           python -m pip install mmdet
#           python -m pip install -r requirements.txt
#       - name: Build and install
#         run: |
#           python -m pip install -e .
#       - name: Run unittests and generate coverage report
#         run: |
#           pytest tests/
