Skip to content

Commit

Permalink
[CI] Add CI for windows and redesign CI (open-mmlab#95)
Browse files Browse the repository at this point in the history
* seperate lint and update matrix

* remove experimental

* redesign github ci

* add windows test

* fix windows permission issue

* fix pytorch link

* download opencv

* delete unused command
  • Loading branch information
wutongshenqiu committed Feb 23, 2022
1 parent 79a676c commit bc5d5c8
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 49 deletions.
149 changes: 100 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,76 @@

name: build

on: [push, pull_request]
on:
push:
paths-ignore:
- "README.md"
- "README_zh-CN.md"
- "model-index.yml"
- "configs/**"
- "docs/**"
- ".dev_scripts/**"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pre-commit hook
run: |
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --all-files
pull_request:
paths-ignore:
- "README.md"
- "README_zh-CN.md"
- "model-index.yml"
- "configs/**"
- "docs/**"
- ".dev_scripts/**"

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

jobs:
test_linux:
runs-on: ubuntu-latest
env:
UBUNTU_VERSION: ubuntu1804
strategy:
matrix:
python-version: [3.7]
torch: [1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0]
torch:
[1.5.1+cpu, 1.6.0+cpu, 1.7.1+cpu, 1.8.0+cpu, 1.9.0+cpu, 1.10.1+cpu]
include:
- torch: 1.5.0
torchvision: 0.6.0
- torch: 1.6.0
torchvision: 0.7.0
- torch: 1.7.0
torchvision: 0.8.1
- torch: 1.8.0
torchvision: 0.9.0
- torch: 1.8.0
torchvision: 0.9.0
- torch: 1.5.1+cpu
torchvision: 0.6.1+cpu
mmcv_link: cpu/torch1.5
python-version: 3.7
- torch: 1.6.0+cpu
torchvision: 0.7.0+cpu
mmcv_link: cpu/torch1.6
python-version: 3.7
- torch: 1.7.1+cpu
torchvision: 0.8.2+cpu
mmcv_link: cpu/torch1.7
python-version: 3.7
- torch: 1.8.0+cpu
torchvision: 0.9.0+cpu
mmcv_link: cpu/torch1.8
python-version: 3.8
- torch: 1.8.0
torchvision: 0.9.0
python-version: 3.9
- torch: 1.9.0
torchvision: 0.10.0
- torch: 1.9.0
torchvision: 0.10.0
- torch: 1.9.0+cpu
torchvision: 0.10.0+cpu
mmcv_link: cpu/torch1.9
python-version: 3.8
- torch: 1.9.0
torchvision: 0.10.0
- torch: 1.10.1+cpu
torchvision: 0.11.2+cpu
mmcv_link: cpu/torch1.10
python-version: 3.9

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Pillow
run: pip install Pillow==6.2.2
if: ${{matrix.torchvision < 0.5}}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install PyTorch
run: pip install --use-deprecated=legacy-resolver torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install MMCV
run: |
pip install --use-deprecated=legacy-resolver mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch${{matrix.torch}}/index.html
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/${{matrix.mmcv_link}}/index.html
python -c 'import mmcv; print(mmcv.__version__)'
- name: Install mmcls dependencies
- name: Install unittest dependencies
run: |
pip install -r requirements.txt
- name: Install timm
Expand All @@ -85,8 +89,55 @@ jobs:
coverage report -m --omit="mmrazor/apis/*"
# Only upload coverage report for python3.7 && pytorch1.5
- name: Upload coverage to Codecov
if: ${{matrix.torch == '1.5.0' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v1.0.10
if: ${{matrix.torch == '1.5.1+cpu' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false

test_windows:
runs-on: windows-latest
strategy:
matrix:
torch: [1.8.2+cpu]
torchvision: [0.9.2+cpu]
mmcv_link: [cpu/torch1.8]
python-version: [3.8]
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 --user
- name: Install PyTorch
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install OpenCV
run: |
pip install opencv-python>=3
- 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.txt
- name: Install timm
run: |
pip install timm
- name: Build and install
run: |
pip install -e . -U
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmrazor -m pytest tests/
coverage xml
coverage report -m --omit="mmrazor/apis/*"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
flags: unittests
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: lint

on: [push, pull_request]

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

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pre-commit hook
run: |
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --all-files
- name: Check docstring coverage
run: |
pip install interrogate
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmrazor

0 comments on commit bc5d5c8

Please sign in to comment.