Skip to content

Commit

Permalink
Add CI for windows (#47)
Browse files Browse the repository at this point in the history
* [Docs] update batch size

* add windows ci

* add windows ci

* update windows ci

* update windows ci

* update win ci

* update test file

* update win ci to cu102
  • Loading branch information
linyq17 committed Mar 11, 2022
1 parent a8b528d commit 8d6bf1d
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,41 @@ jobs:
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, cu102]
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 MMCLS and MMDET
run: pip install mmcls mmdet
- 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 mmfewshot -m pytest tests/
- name: Generate coverage report
run: |
coverage xml
coverage report -m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile

import numpy as np
Expand Down Expand Up @@ -144,10 +145,10 @@ def test_few_shot_coco_dataset():

# test save and load dataset
with tempfile.TemporaryDirectory() as tmpdir:
dataset.save_data_infos(tmpdir + 'ann.json')
dataset.save_data_infos(tmpdir + f'{os.sep}ann.json')
data_config['ann_cfg'] = [{
'type': 'saved_dataset',
'ann_file': tmpdir + 'ann.json'
'ann_file': tmpdir + f'{os.sep}ann.json'
}]
dataset = FewShotCocoDataset(**data_config)
count = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile

import numpy as np
Expand Down Expand Up @@ -108,10 +109,10 @@ def test_few_shot_voc_dataset():
dataset.data_infos[1]['ann']['bboxes_ignore'] = np.array(
[[11, 11, 100, 100]])
dataset.data_infos[1]['ann']['labels_ignore'] = np.array([0])
dataset.save_data_infos(tmpdir + 'ann.json')
dataset.save_data_infos(tmpdir + f'{os.sep}ann.json')
data_config['ann_cfg'] = [{
'type': 'saved_dataset',
'ann_file': tmpdir + 'ann.json'
'ann_file': tmpdir + f'{os.sep}ann.json'
}]
dataset = FewShotVOCDataset(**data_config)
count = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile

import numpy as np
Expand Down Expand Up @@ -85,4 +86,4 @@ def test_nway_kshot_dataset():
assert count <= 1
# test save dataset
with tempfile.TemporaryDirectory() as tmpdir:
nway_kshot_dataset.save_data_infos(tmpdir + 'ann.json')
nway_kshot_dataset.save_data_infos(tmpdir + f'{os.sep}ann.json')
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile

import numpy as np
Expand Down Expand Up @@ -115,4 +116,4 @@ def test_query_aware_dataset():

# test save dataset
with tempfile.TemporaryDirectory() as tmpdir:
query_aware_dataset.save_data_infos(tmpdir + 'ann.json')
query_aware_dataset.save_data_infos(tmpdir + f'{os.sep}ann.json')
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile

from mmdet.apis import set_random_seed
Expand Down Expand Up @@ -45,4 +46,4 @@ def test_two_branch_dataset():
assert len(two_branch_dataset) == 25
# test save dataset
with tempfile.TemporaryDirectory() as tmpdir:
two_branch_dataset.save_data_infos(tmpdir + 'ann.json')
two_branch_dataset.save_data_infos(tmpdir + f'{os.sep}ann.json')

0 comments on commit 8d6bf1d

Please sign in to comment.