Add ci
pull/9/head
Wenwei Zhang 2021-05-20 19:55:12 +08:00 committed by GitHub
commit 21d7b1e59d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 110 additions and 0 deletions

86
.github/workflows/build.yml vendored 100644
View File

@ -0,0 +1,86 @@
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@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 60 mim
test:
runs-on: ubuntu-latest
env:
CUDA: 10.1.105-1
CUDA_SHORT: 10.1
UBUNTU_VERSION: ubuntu1804
FORCE_CUDA: 1
strategy:
matrix:
python-version: [3.7]
torch: [1.5.0+cu101, 1.8.0+cu101]
include:
- torch: 1.5.0+cu101
torchvision: 0.6.0+cu101
- torch: 1.8.0+cu101
torchvision: 0.9.0+cu101
- torch: 1.8.0+cu101
torchvision: 0.9.0+cu101
python-version: 3.6
- torch: 1.8.0+cu101
torchvision: 0.9.0+cu101
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: Install CUDA
run: |
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
sudo dpkg -i ${INSTALLER}
wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub
sudo apt-key add 7fa2af80.pub
sudo apt update -qq
sudo apt install -y cuda-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-}
sudo apt clean
export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT}
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/include:${LD_LIBRARY_PATH}
export PATH=${CUDA_HOME}/bin:${PATH}
- name: Install PyTorch
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Validate the installation
run: python -c "import mim"
- name: Install unittest dependencies
run: pip install -r requirements/tests.txt
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source=mim -m pytest tests/ --ignore tests/test_gridsearch.py --ignore tests/test_run.py --ignore tests/test_test.py --ignore tests/test_train.py --ignore tests/test_train.py
coverage xml
coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.10
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false

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

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

View File

@ -0,0 +1,4 @@
coverage
flake8
interrogate
pytest