workflow: modify build, add deploy (#61)

* workflow: modify build, add deploy

* fix type: mmseg -> mmcls

* simplify build by delete cuda related settings

* re-sort requirements by pre-commit hook

* build: support more pytorch versions

* build: fix torchvision version bug

* del useless test imports

* merge upstream

* build: del docstring checking to pass coverage check
pull/64/head
Y. Xiong 2020-10-10 22:15:50 +08:00 committed by GitHub
parent 24fd4fb627
commit c00ee6a876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 20 deletions

View File

@ -6,26 +6,44 @@ name: build
on: [push, pull_request]
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
build:
runs-on: ubuntu-latest
env:
CUDA: 10.1.105-1
CUDA_SHORT: 10.1
UBUNTU_VERSION: ubuntu1804
FORCE_CUDA: 1
CUDA_ARCH: ${{matrix.cuda_arch}}
strategy:
matrix:
python-version: [3.6, 3.7]
torch: [1.3.0, 1.5.0]
python-version: [3.7]
torch: [1.3.0+cpu, 1.4.0+cpu, 1.5.0+cpu, 1.6.0+cpu]
include:
- torch: 1.3.0
torchvision: 0.4.2
cuda_arch: "6.0"
- torch: 1.5.0
torchvision: 0.6.0
cuda_arch: "7.0"
- torch: 1.3.0+cpu
torchvision: 0.4.2+cpu
- torch: 1.4.0+cpu
torchvision: 0.5.0+cpu
- torch: 1.5.0+cpu
torchvision: 0.6.0+cpu
- torch: 1.6.0+cpu
torchvision: 0.7.0+cpu
- torch: 1.6.0+cpu
torchvision: 0.7.0+cpu
python-version: 3.6
- torch: 1.6.0+cpu
torchvision: 0.7.0+cpu
python-version: 3.8
steps:
- uses: actions/checkout@v2
@ -50,8 +68,7 @@ jobs:
- name: Build and install
run: |
rm -rf .eggs
python setup.py check -m -s
TORCH_CUDA_ARCH_LIST=${CUDA_ARCH} python setup.py build_ext --inplace
pip install -e . -U
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmcls -m pytest tests/
@ -59,7 +76,7 @@ jobs:
coverage report -m --omit="mmcls/utils/*","mmcls/apis/*"
# Only upload coverage report for python3.7 && pytorch1.5
- name: Upload coverage to Codecov
if: ${{matrix.torch == '1.5.0+cu101' && matrix.python-version == '3.7'}}
if: ${{matrix.torch == '1.5.0+cpu' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v1.0.10
with:
file: ./coverage.xml

22
.github/workflows/deploy.yml vendored 100644
View File

@ -0,0 +1,22 @@
name: deploy
on: push
jobs:
build-n-publish:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Build MMClassification
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
run: |
pip install twine
twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }}

View File

@ -1,3 +1,3 @@
-r requirements/runtime.txt
-r requirements/optional.txt
-r requirements/runtime.txt
-r requirements/tests.txt

View File

@ -1,3 +1,3 @@
matplotlib
mmcv
numpy
matplotlib

View File

@ -1,4 +1,3 @@
asynctest
codecov
flake8
interrogate

View File

@ -17,6 +17,6 @@ line_length = 79
multi_line_output = 0
known_standard_library = pkg_resources,setuptools
known_first_party = mmcls
known_third_party = PIL,cv2,mmcv,numpy,onnxruntime,pytest,torch,torchvision
known_third_party = PIL,cv2,matplotlib,mmcv,numpy,onnxruntime,pytest,torch,torchvision
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY