From 8aca73e187837fde4df419bd8c597800a71ca32c Mon Sep 17 00:00:00 2001 From: MengzhangLI Date: Tue, 13 Sep 2022 13:43:13 +0800 Subject: [PATCH] [CI] Fix CI (#2029) * [CI] Fix CI * fix wrong command * remove mmcv * fix lint error * add pytorch install * fix pytorch installation * fix mmengine error * fix mmcv installation in pr_stage * fix docstring coverage in lint and delete cu102 in pr_stage windows * fix lint.yml and reset test.yml * ignore some ut in build_windows of pr_stage * test merge stage test * fix mmseg dependencies in pr_stage_test.yml * delete redundant lines in pr_stage and fix mmseg dependencies in mr_stage * fix error in merge_stage * delete python -m in merge_stage * fix error in merge_stage * let mmcv installation before mmengine * fix error of mmcv not found * fix ut error in merge)stage_test.yml * fix build_windows ut in metge_stage * fix error * fix windows error of merge_stag * Update .github/workflows/merge_stage_test.yml * Update .github/workflows/merge_stage_test.yml * Update .github/workflows/merge_stage_test.yml * fix error * delete skip timm ut * add requitements/optinal.txt in test.yml * Update .github/workflows/merge_stage_test.yml Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com> --- .circleci/test.yml | 55 +++--- .github/workflows/build.yml | 260 ------------------------- .github/workflows/lint.yml | 6 +- .github/workflows/merge_stage_test.yml | 196 +++++++++++++++++++ .github/workflows/pr_stage_test.yml | 141 ++++++++++++++ .pre-commit-config.yaml | 2 +- 6 files changed, 365 insertions(+), 295 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/merge_stage_test.yml create mode 100644 .github/workflows/pr_stage_test.yml diff --git a/.circleci/test.yml b/.circleci/test.yml index d2cdb905e4..f97d180f5f 100644 --- a/.circleci/test.yml +++ b/.circleci/test.yml @@ -36,8 +36,6 @@ jobs: type: string torchvision: type: string - mmcv: - type: string docker: - image: cimg/python:<< parameters.python >> resource_class: large @@ -51,31 +49,32 @@ jobs: - run: name: Configure Python & pip command: | - python -m pip install --upgrade pip - python -m pip install wheel + pip install --upgrade pip + pip install wheel - run: name: Install PyTorch command: | python -V - python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html + pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html - run: name: Install mmseg dependencies command: | - python -m pip install git+ssh://git@github.com/open-mmlab/mmengine.git@main - python -m pip install << parameters.mmcv >> - python -m pip install git+ssh://git@github.com/open-mmlab/mmclassification@dev-1.x - python -m pip install -r requirements.txt + pip install git+https://github.com/open-mmlab/mmengine.git@main + pip install -U openmim + mim install 'mmcv >= 2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification@dev-1.x + pip install -r requirements/tests.txt -r requirements/optional.txt - run: name: Build and install command: | - python -m pip install -e . + pip install -e . - run: name: Run unittests command: | - python -m pip install timm - python -m coverage run --branch --source mmseg -m pytest tests/ - python -m coverage xml - python -m coverage report -m + pip install timm + coverage run --branch --source mmseg -m pytest tests/ + coverage xml + coverage report -m - run: name: Skip timm unittests and generate coverage report command: | @@ -92,8 +91,6 @@ jobs: cudnn: type: integer default: 7 - mmcv: - type: string machine: image: ubuntu-2004-cuda-11.4:202110-01 # docker_layer_caching: true @@ -104,8 +101,8 @@ jobs: # Cloning repos in VM since Docker doesn't have access to the private key name: Clone Repos command: | - git clone -b main --depth 1 ssh://git@github.com/open-mmlab/mmengine.git /home/circleci/mmengine - git clone -b dev-1.x --depth 1 ssh://git@github.com/open-mmlab/mmclassification.git /home/circleci/mmclassification + git clone -b main --depth 1 https://github.com/open-mmlab/mmengine.git /home/circleci/mmengine + git clone -b dev-1.x --depth 1 https://github.com/open-mmlab/mmclassification.git /home/circleci/mmclassification - run: name: Build Docker image command: | @@ -115,9 +112,10 @@ jobs: name: Install mmseg dependencies command: | docker exec mmseg pip install -e /mmengine - docker exec mmseg pip install << parameters.mmcv >> + docker exec mmseg pip install -U openmim + docker exec mmseg mim install 'mmcv >= 2.0.0rc1' docker exec mmseg pip install -e /mmclassification - docker exec mmseg python -m pip install -r requirements.txt + docker exec mmseg pip install -r requirements/tests.txt -r requirements/optional.txt - run: name: Build and install command: | @@ -125,8 +123,8 @@ jobs: - run: name: Run unittests command: | - docker exec mmseg python -m pip install timm - docker exec mmseg python -m pytest tests/ + docker exec mmseg pip install timm + docker exec mmseg pytest tests/ workflows: pr_stage_lint: when: << pipeline.parameters.lint_only >> @@ -137,7 +135,7 @@ workflows: branches: ignore: - dev-1.x - - test-1.x + - 1.x pr_stage_test: when: not: @@ -149,21 +147,19 @@ workflows: branches: ignore: - dev-1.x - - test-1.x + - 1.x - build_cpu: name: minimum_version_cpu torch: 1.6.0 torchvision: 0.7.0 python: 3.6.9 # The lowest python 3.6.x version available on CircleCI images - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cpu/torch1.6.0/mmcv_full-2.0.0rc0-cp36-cp36m-manylinux1_x86_64.whl requires: - lint - build_cpu: name: maximum_version_cpu - torch: 1.9.0 - torchvision: 0.10.0 + torch: 1.12.1 + torchvision: 0.13.1 python: 3.9.0 - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cpu/torch1.9.0/mmcv_full-2.0.0rc0-cp39-cp39-manylinux1_x86_64.whl requires: - minimum_version_cpu - hold: @@ -176,7 +172,6 @@ workflows: # Use double quotation mark to explicitly specify its type # as string instead of number cuda: "10.2" - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cu102/torch1.8.0/mmcv_full-2.0.0rc0-cp37-cp37m-manylinux1_x86_64.whl requires: - hold merge_stage_test: @@ -189,10 +184,8 @@ workflows: torch: 1.6.0 # Use double quotation mark to explicitly specify its type # as string instead of number - mmcv: https://download.openmmlab.com/mmcv/dev-2.x/cu101/torch1.6.0/mmcv_full-2.0.0rc0-cp37-cp37m-manylinux1_x86_64.whl cuda: "10.1" filters: branches: only: - dev-1.x - - test-1.x diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 640dc4d0ad..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,260 +0,0 @@ -name: build - -on: - push: - paths-ignore: - - 'demo/**' - - '.dev/**' - - 'docker/**' - - 'tools/**' - - '**.md' - - pull_request: - paths-ignore: - - 'demo/**' - - '.dev/**' - - 'docker/**' - - 'tools/**' - - 'docs/**' - - '**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build_cpu: - runs-on: ubuntu-18.04 - strategy: - matrix: - python-version: [3.7] - torch: [1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0] - include: - - torch: 1.5.1 - torch_version: torch1.5 - torchvision: 0.6.1 - - torch: 1.6.0 - torch_version: torch1.6 - torchvision: 0.7.0 - - torch: 1.7.0 - torch_version: torch1.7 - torchvision: 0.8.1 - - torch: 1.8.0 - torch_version: torch1.8 - torchvision: 0.9.0 - - torch: 1.9.0 - torch_version: torch1.9 - torchvision: 0.10.0 - 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: Install Pillow - run: pip install Pillow==6.2.2 - if: ${{matrix.torchvision == '0.4.2'}} - - 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/${{matrix.torch_version}}/index.html - python -c 'import mmcv; print(mmcv.__version__)' - - name: Install unittest 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: | - pip install timm - coverage run --branch --source mmseg -m pytest tests/ - coverage xml - coverage report -m - if: ${{matrix.torch >= '1.5.0'}} - - name: Skip timm unittests and generate coverage report - run: | - coverage run --branch --source mmseg -m pytest tests/ --ignore tests/test_models/test_backbones/test_timm_backbone.py - coverage xml - coverage report -m - if: ${{matrix.torch < '1.5.0'}} - - build_cuda101: - runs-on: ubuntu-18.04 - container: - image: pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel - - strategy: - matrix: - python-version: [3.7] - torch: - [ - 1.5.1+cu101, - 1.6.0+cu101, - 1.7.0+cu101, - 1.8.0+cu101 - ] - include: - - torch: 1.5.1+cu101 - torch_version: torch1.5 - torchvision: 0.6.1+cu101 - - torch: 1.6.0+cu101 - torch_version: torch1.6 - torchvision: 0.7.0+cu101 - - torch: 1.7.0+cu101 - torch_version: torch1.7 - torchvision: 0.8.1+cu101 - - torch: 1.8.0+cu101 - torch_version: torch1.8 - torchvision: 0.9.0+cu101 - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - 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: Install system dependencies - run: | - apt-get update && apt-get install -y libgl1-mesa-glx ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 python${{matrix.python-version}}-dev - apt-get clean - rm -rf /var/lib/apt/lists/* - - name: Install Pillow - run: python -m pip install Pillow==6.2.2 - if: ${{matrix.torchvision < 0.5}} - - name: Install PyTorch - run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html - - name: Install mmseg dependencies - run: | - python -V - python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/${{matrix.torch_version}}/index.html - python -m pip install -r requirements.txt - python -c 'import mmcv; print(mmcv.__version__)' - - name: Build and install - run: | - rm -rf .eggs - python setup.py check -m -s - TORCH_CUDA_ARCH_LIST=7.0 pip install . - - name: Run unittests and generate coverage report - run: | - python -m pip install timm - coverage run --branch --source mmseg -m pytest tests/ - coverage xml - coverage report -m - if: ${{matrix.torch >= '1.5.0'}} - - name: Skip timm unittests and generate coverage report - run: | - coverage run --branch --source mmseg -m pytest tests/ --ignore tests/test_models/test_backbones/test_timm_backbone.py - coverage xml - coverage report -m - if: ${{matrix.torch < '1.5.0'}} - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1.0.10 - with: - file: ./coverage.xml - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: false - - build_cuda102: - runs-on: ubuntu-18.04 - container: - image: pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel - - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - torch: [1.9.0+cu102] - include: - - torch: 1.9.0+cu102 - torch_version: torch1.9 - torchvision: 0.10.0+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: 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: Install system dependencies - run: | - apt-get update && apt-get install -y libgl1-mesa-glx ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 - apt-get clean - rm -rf /var/lib/apt/lists/* - - name: Install Pillow - run: python -m pip install Pillow==6.2.2 - if: ${{matrix.torchvision < 0.5}} - - name: Install PyTorch - run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html - - name: Install mmseg dependencies - run: | - python -V - python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/${{matrix.torch_version}}/index.html - python -m pip install -r requirements.txt - python -c 'import mmcv; print(mmcv.__version__)' - - name: Build and install - run: | - rm -rf .eggs - python setup.py check -m -s - TORCH_CUDA_ARCH_LIST=7.0 pip install . - - name: Run unittests and generate coverage report - run: | - python -m pip install timm - coverage run --branch --source mmseg -m pytest tests/ - coverage xml - coverage report -m - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - files: ./coverage.xml - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: false - - test_windows: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2022] - python: [3.8] - platform: [cpu, cu111] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Upgrade pip - run: pip install pip --upgrade --user - - name: Install OpenCV - run: pip install opencv-python>=3 - - name: Install PyTorch - # As a complement to Linux CI, we test on PyTorch LTS version - run: pip install torch==1.8.2+${{ matrix.platform }} torchvision==0.9.2+${{ matrix.platform }} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html - - name: Install MMCV - run: | - pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8/index.html --only-binary mmcv-full - - name: Install unittest dependencies - run: pip install -r requirements/tests.txt -r requirements/optional.txt - - name: Build and install - run: pip install -e . - - name: Run unittests - run: | - python -m pip install timm - coverage run --branch --source mmseg -m pytest tests/ - - name: Generate coverage report - run: | - coverage xml - coverage report -m diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7f7a309280..de1cab2558 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: python-version: 3.7 - name: Install pre-commit hook run: | - pip install pre-commit + python -m pip install pre-commit pre-commit install - name: Linting run: | @@ -27,5 +27,5 @@ jobs: pre-commit run --all-files - name: Check docstring coverage run: | - pip install interrogate - interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --exclude mmseg/ops --ignore-regex "__repr__" --fail-under 80 mmseg + python -m pip install interrogate + interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --exclude mmseg/ops --ignore-regex "__repr__" --fail-under 75 mmseg diff --git a/.github/workflows/merge_stage_test.yml b/.github/workflows/merge_stage_test.yml new file mode 100644 index 0000000000..9d66cde3e9 --- /dev/null +++ b/.github/workflows/merge_stage_test.yml @@ -0,0 +1,196 @@ +name: merge_stage_test + +on: + push: + paths-ignore: + - 'README.md' + - 'README_zh-CN.md' + - 'docs/**' + - 'demo/**' + - '.dev_scripts/**' + - '.circleci/**' + branches: + - dev-1.x + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_cpu_py: + runs-on: ubuntu-18.04 + strategy: + matrix: + python-version: [3.6, 3.8, 3.9] + torch: [1.8.1] + 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: Install Pillow + run: pip install Pillow==6.2.2 + if: ${{matrix.torchvision == '0.4.2'}} + - 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 mmseg dependencies + run: | + python -V + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: rm -rf .eggs && pip install -e . + - name: Run unittests and generate coverage report + run: | + pip install timm + coverage run --branch --source mmseg -m pytest tests/ + coverage xml + coverage report -m + build_cpu_pt: + runs-on: ubuntu-18.04 + strategy: + matrix: + python-version: [3.7] + torch: [1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.1, 1.11.0] + include: + - torch: 1.6.0 + torchvision: 0.7.0 + - torch: 1.7.1 + torchvision: 0.8.2 + - torch: 1.8.1 + torchvision: 0.9.1 + - torch: 1.9.1 + torchvision: 0.10.1 + - torch: 1.10.1 + torchvision: 0.11.2 + - torch: 1.11.0 + torchvision: 0.12.0 + 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: Install Pillow + run: pip install Pillow==6.2.2 + - 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 mmseg dependencies + run: | + python -V + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: rm -rf .eggs && pip install -e . + - name: Run unittests and generate coverage report + run: | + pip install timm + coverage run --branch --source mmseg -m pytest tests/ + coverage xml + coverage report -m + # Only upload coverage report for python3.7 && pytorch1.8.1 cpu + - name: Upload coverage to Codecov + if: ${{matrix.torch == '1.8.1' && matrix.python-version == '3.7'}} + uses: codecov/codecov-action@v2 + with: + files: ./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] + include: + - torch: 1.8.1 + cuda: 10.2 + 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: 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: 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 libsm6 libxrender-dev libxext6 + - name: Install mmseg dependencies + run: | + python -V + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: | + python setup.py check -m -s + TORCH_CUDA_ARCH_LIST=7.0 pip install -e . + build_windows: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022] + python: [3.7] + platform: [cpu, cu111] + 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: Install OpenCV + run: pip install opencv-python>=3 + - name: Install PyTorch + run: 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 mmseg dependencies + run: | + python -V + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: pip install -e . + - name: Run unittests + run: | + pip install timm + coverage run --branch --source mmseg -m pytest tests/ --ignore tests\test_models\test_forward.py tests\test_models\test_backbones\test_beit.py + - name: Generate coverage report + run: | + coverage xml + coverage report -m diff --git a/.github/workflows/pr_stage_test.yml b/.github/workflows/pr_stage_test.yml new file mode 100644 index 0000000000..ba8b675d63 --- /dev/null +++ b/.github/workflows/pr_stage_test.yml @@ -0,0 +1,141 @@ +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: Install Pillow + run: pip install Pillow==6.2.2 + if: ${{matrix.torchvision == '0.4.2'}} + - 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 other dependencies + run: | + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: rm -rf .eggs && pip install -e . + - name: Run unittests and generate coverage report + run: | + pip install timm + coverage run --branch --source mmseg -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: 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: 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 mmseg dependencies + run: | + python -V + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: | + python setup.py check -m -s + TORCH_CUDA_ARCH_LIST=7.0 pip install -e . + build_windows: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022] + python: [3.7] + platform: [cpu, cu111] + 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: Install OpenCV + run: pip install opencv-python>=3 + - name: Install PyTorch + run: 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 mmseg dependencies + run: | + python -V + pip install -U openmim + pip install git+https://github.com/open-mmlab/mmengine.git + mim install 'mmcv>=2.0.0rc1' + pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x + - name: Install unittest dependencies + run: pip install -r requirements/tests.txt -r requirements/optional.txt + - name: Build and install + run: pip install -e . + - name: Run unittests + run: | + pip install timm + coverage run --branch --source mmseg -m pytest tests/ --ignore tests\test_models\test_forward.py tests\test_models\test_backbones\test_beit.py + - name: Generate coverage report + run: | + coverage xml + coverage report -m diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 884f5cd1e9..0e3e179633 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,7 +48,7 @@ repos: name: update-model-index description: Collect model information and update model-index.yml entry: .dev/md2yml.py - additional_dependencies: [mmcv, lxml, opencv-python] + additional_dependencies: [lxml, opencv-python, mmengine] language: python files: ^configs/.*\.md$ require_serial: true