From 1ab646de1707c80529fc9104cded58cee375fba9 Mon Sep 17 00:00:00 2001 From: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:15:00 +0800 Subject: [PATCH] Skip mmcv in CI when torch < 1.8 (#1199) --- .circleci/test.yml | 23 +++++++++++++++++------ .github/workflows/merge_stage_test.yml | 20 +++++++++++++------- .github/workflows/pr_stage_test.yml | 8 ++++---- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/.circleci/test.yml b/.circleci/test.yml index 54393c66..dd2f268b 100644 --- a/.circleci/test.yml +++ b/.circleci/test.yml @@ -89,8 +89,14 @@ jobs: name: Install unit tests dependencies command: | pip install -r requirements/tests.txt - pip install openmim - mim install 'mmcv>=2.0.0rc1' + - run: + name: Install mmcv + command: | + export PYTORCH=<< parameters.torch >> + if [[ "${PYTORCH}" > "1.8.0" || "${PYTORCH}" == "1.8.0" ]]; then + pip install openmim + mim install mmcv + fi - run: name: Run unittests command: | @@ -118,7 +124,7 @@ jobs: name: Build Docker image command: | docker build .circleci/docker -t mmengine:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >> - docker run --gpus all -t -d -v /home/circleci/project:/mmengine -w /mmengine --name mmengine mmengine:gpu + docker run --gpus all -t -d -v /home/circleci/project:/mmengine -e PYTORCH=<< parameters.torch >> -w /mmengine --name mmengine mmengine:gpu - run: name: Build MMEngine from source command: | @@ -127,8 +133,13 @@ jobs: name: Install unit tests dependencies command: | docker exec mmengine pip install -r requirements/tests.txt - docker exec mmengine pip install openmim - docker exec mmengine mim install 'mmcv>=2.0.0rc1' + - run: + name: Install mmcv + command: | + if [[ "${PYTORCH}" > "1.8.0" || "${PYTORCH}" == "1.8.0" ]]; then + docker exec mmengine pip install openmim + docker exec mmengine mim install mmcv + fi - run: name: Run unittests command: | @@ -163,7 +174,7 @@ jobs: command: | docker exec mmengine pip install -r requirements/tests.txt docker exec mmengine pip install openmim - docker exec mmengine mim install 'mmcv>=2.0.0rc1' + docker exec mmengine mim install mmcv - run: name: Install down stream repositories command: | diff --git a/.github/workflows/merge_stage_test.yml b/.github/workflows/merge_stage_test.yml index dcd8f902..9037e56a 100644 --- a/.github/workflows/merge_stage_test.yml +++ b/.github/workflows/merge_stage_test.yml @@ -45,7 +45,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv - name: Run unittests and generate coverage report run: | coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist @@ -95,8 +95,11 @@ jobs: - name: Install unit tests dependencies run: | pip install -r requirements/tests.txt + - name: Install mmcv + run: | pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv + if: ${{ matrix.torch > '1.8.0' || matrix.torch == '1.8.0' } - name: Run unittests and generate coverage report run: | coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist @@ -143,7 +146,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv - name: Run unittests and generate coverage report run: | coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist @@ -177,7 +180,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv # Distributed related unit test may randomly error in PyTorch 1.13.0 - name: Run unittests and generate coverage report run: | @@ -212,7 +215,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv # Distributed related unit test may randomly error in PyTorch 1.13.0 - name: Run unittests and generate coverage report run: | @@ -250,8 +253,11 @@ jobs: - name: Install unit tests dependencies run: | pip install -r requirements/tests.txt + - name: Install mmcv + run: | pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv + if: ${{ matrix.torch > '1.8.0' || matrix.torch == '1.8.0' } # Distributed-related unit tests may fail in macOS # Skip testing setup_env since it does not work in the current CI environment # TODO - name: Run unittests and generate coverage report @@ -290,7 +296,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv - name: Run CPU unittests run: pytest tests/ --ignore tests/test_dist if: ${{ matrix.platform == 'cpu' }} diff --git a/.github/workflows/pr_stage_test.yml b/.github/workflows/pr_stage_test.yml index e5578ab9..69c070bd 100644 --- a/.github/workflows/pr_stage_test.yml +++ b/.github/workflows/pr_stage_test.yml @@ -44,7 +44,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv - name: Run unittests and generate coverage report run: | coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist @@ -89,7 +89,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv - name: Run unittests and generate coverage report run: | coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist @@ -123,7 +123,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv # Distributed related unit test may randomly error in PyTorch 1.13.0 - name: Run unittests and generate coverage report run: | @@ -161,7 +161,7 @@ jobs: run: | pip install -r requirements/tests.txt pip install openmim - mim install 'mmcv>=2.0.0rc1' + mim install mmcv - name: Run CPU unittests run: pytest tests/ --ignore tests/test_dist if: ${{ matrix.platform == 'cpu' }}