Skip to content

Commit

Permalink
minor change github action workflow (open-mmlab#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamerlin authored Jul 20, 2020
1 parent b96aab9 commit c1e93cb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 25 deletions.
62 changes: 39 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,50 @@ name: build
on: [push, pull_request]

jobs:
build:
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 linting dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 isort==4.3.21 yapf interrogate
- name: Lint with flake8
run: flake8 .
- name: Lint with isort
run: isort --recursive --check-only --diff mmaction/ tools/ tests/ demo/
- name: Format python codes with yapf
run: yapf -r -d mmaction/ tools/ configs/ tests/ demo/
- name: Check docstring
run: interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmaction

build:
env:
CUDA: 10.1.105-1
CUDA_SHORT: 10.1
UBUNTU_VERSION: ubuntu1804
FORCE_CUDA: 1
MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7]
torch: [1.3.0, 1.5.0]
torch: [1.3.0+cpu, 1.5.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.5.0+cpu
torchvision: 0.6.0+cpu
- torch: 1.5.0+cpu
torchvision: 0.6.0+cpu
python-version: 3.8
- torch: 1.5.0+cu101
torchvision: 0.6.0+cu101
python-version: 3.7

steps:
- uses: actions/checkout@v2
Expand All @@ -30,6 +55,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install CUDA
if: ${{matrix.torch == '1.5.0+cu101'}}
run: |
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
Expand All @@ -44,36 +70,26 @@ jobs:
export PATH=${CUDA_HOME}/bin:${PATH}
sudo apt-get install -y ninja-build
- name: Install Pillow
if: ${{matrix.torchvision == '0.4.2+cpu'}}
run: pip install Pillow==6.2.2
if: ${{matrix.torchvision < 0.5}}
- name: Install TurboJpeg lib
run: sudo apt-get install -y libturbojpeg
- name: Install PyTorch
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}}
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install mmaction dependencies
run: |
pip install mmcv
pip install -r requirements.txt
- name: Lint with flake8
run: flake8 .
- name: Lint with isort
run: isort --recursive --check-only --diff mmaction/ tools/ tests/
- name: Format with yapf
run: yapf -r -d mmaction/ tools/ configs/ tests/
- name: Check docstring
run: interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmaction
- name: Build and install
env:
CUDA_ARCH: ${{matrix.cuda_arch}}
run: |
rm -rf .eggs
python setup.py check -m
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmaction -m pytest tests/
coverage xml
coverage report -m
# 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'}}
uses: codecov/[email protected]
with:
file: ./coverage.xml
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def write_version_py():
sha = get_hash()
with open('mmaction/VERSION', 'r') as f:
SHORT_VERSION = f.read().strip()
VERSION_INFO = ', '.join(SHORT_VERSION.split('.'))
VERSION_INFO = ', '.join(
[x if x.isdigit() else f'"{x}"' for x in SHORT_VERSION.split('.')])
VERSION = SHORT_VERSION + '+' + sha

version_file_str = content.format(time.asctime(), VERSION, SHORT_VERSION,
Expand Down Expand Up @@ -109,6 +110,8 @@ def parse_line(line):
info = {'line': line}
if line.startswith('-e '):
info['package'] = line.split('#egg=')[1]
elif '@git+' in line:
info['package'] = line
else:
# Remove versioning from the package
pat = '(' + '|'.join(['>=', '==', '>']) + ')'
Expand Down Expand Up @@ -160,8 +163,10 @@ def gen_packages_items():
setup(
name='mmaction',
version=get_version(),
description='Open MMLab Action Recognition Toolbox',
description='OpenMMLab Action Understanding Toolbox',
long_description=readme(),
maintainer='MMAction Authors',
maintainer_email='[email protected]',
packages=find_packages(exclude=('configs', 'tools', 'demo')),
package_data={'mmaction.ops': ['*/*.so']},
classifiers=[
Expand Down

0 comments on commit c1e93cb

Please sign in to comment.