Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 216 GitHub actions #220

Merged
merged 14 commits into from
Jul 6, 2020
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 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 dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install .[test]
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 mavis --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Lint with black
run: |
pip install black
# stop the build if black needs to be run
black mavis -S -l 100 --check
- name: install bwa
run: |
git clone https://github.com/lh3/bwa.git
cd bwa
git checkout v0.7.17
make
cd ..
- name: install blat
run: |
wget http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/blat/blat
chmod a+x blat
- name: run short tests with pytest
run: |
export PATH=$PATH:$(pwd):$(pwd)/bwa
pytest tests -v --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov mavis --cov-report term --cov-report xml --durations=10
env:
RUN_FULL: 0
if: github.event_name != 'pull_request'
- name: run full tests with pytest
run: |
export PATH=$PATH:$(pwd):$(pwd)/bwa
pytest tests -v --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov mavis --cov-report term --cov-report xml --durations=10
env:
RUN_FULL: 1
if: github.event_name == 'pull_request'
- name: Upload pytest test results
uses: actions/upload-artifact@master
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: always()
- name: Update code coverage report to CodeCov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: publish

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel install
twine check dist/*
twine upload dist/*
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</object>


![PyPi](https://img.shields.io/pypi/v/mavis.svg) ![Travis](https://travis-ci.org/bcgsc/mavis.svg?branch=master) ![ReadTheDocs](https://readthedocs.org/projects/pip/badge/)
![PyPi](https://img.shields.io/pypi/v/mavis.svg) ![build](https://github.com/bcgsc/mavis/workflows/build/badge.svg?branch=master) [![codecov](https://codecov.io/gh/bcgsc/mavis/branch/master/graph/badge.svg)](https://codecov.io/gh/bcgsc/mavis) ![ReadTheDocs](https://readthedocs.org/projects/pip/badge/)


# About
Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: 80%
threshold: 1%
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def check_nonpython_dependencies():
'pycodestyle>=2.3.1',
'pytest',
'pytest-cov',
'tox',
]


Expand Down
24 changes: 0 additions & 24 deletions tests/test_style.py

This file was deleted.

3 changes: 3 additions & 0 deletions tests/unit/test_assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import random
import os
import unittest
import pytest

from mavis.assemble import assemble, Contig, DeBruijnGraph, filter_contigs, kmers
from mavis.constants import DNA_ALPHABET
Expand Down Expand Up @@ -91,6 +92,7 @@ def test_drop_similar_different_lengths(self):


class TestDeBruijnGraph(unittest.TestCase):
@pytest.mark.skipif(os.environ.get('RUN_FULL', '0') != '1', reason='running short tests only')
def test_trim_tails_by_freq_forks(self):
g = DeBruijnGraph()
for s, t in itertools.combinations([1, 2, 3, 4, 5, 6], 2):
Expand Down Expand Up @@ -181,6 +183,7 @@ def setUp(self):
with open(os.path.join(DATA_DIR, 'test_assembly_sequences.txt')) as fh:
self.seq = [i.strip() for i in fh.readlines()]

@pytest.mark.skipif(os.environ.get('RUN_FULL', '0') != '1', reason='running short tests only')
def test_deterministic_assembly(self):
contig_sequences = set()
for i in range(20):
Expand Down
18 changes: 0 additions & 18 deletions tox.ini

This file was deleted.