diff --git a/.github/workflows/nosetests.yml b/.github/workflows/nosetests.yml new file mode 100644 index 00000000..6623ab62 --- /dev/null +++ b/.github/workflows/nosetests.yml @@ -0,0 +1,37 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9"] + os: [ubuntu-latest, macOS-latest] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 nose pep8 pyyaml + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Install + run: | + python setup.py install + - name: Test with nosetests + run: | + export PYTHONHASHSEED=0 + nosetests -v tests/test_umi_tools.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c0664644..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: python -sudo: required - -matrix: - include: - - os: linux - sudo: required - python: 3.7.3 - env: TEST_FUNCTIONALITY=1 - - os: linux - sudo: required - python: 3.7.3 - env: TEST_STYLE=1 - -before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install freetype; fi - - pip install cython - - pip install pandas - - pip install scipy -install: - - python setup.py install - -before_script: - - pip install nose - - pip install pep8 - - pip install pyyaml - -script: - - ./test_umi_tools.sh diff --git a/requirements.txt b/requirements.txt index 828dee13..ffe2a5c6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,3 @@ regex scipy matplotlib pybktree -python>=3.5 diff --git a/test_umi_tools.sh b/test_umi_tools.sh deleted file mode 100755 index 78267226..00000000 --- a/test_umi_tools.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# set the dictionary hash 'noise' -export PYTHONHASHSEED=0 - -# run nosetests -if [ $TEST_STYLE ] ; then - nosetests -v tests/test_style.py ; -elif [ $TEST_FUNCTIONALITY ] ; then - nosetests -v tests/test_umi_tools.py ; -elif [ $TEST_HELP ] ; then - umi_tools whitelist --help; - umi_tools extract --help; - umi_tools group --help; - umi_tools dedup --help; - umi_tools count --help; - umi_tools count_tab --help; -fi - - diff --git a/tests/test_umi_tools.py b/tests/test_umi_tools.py index fad3d73d..63b5e8d6 100644 --- a/tests/test_umi_tools.py +++ b/tests/test_umi_tools.py @@ -28,8 +28,6 @@ PYTHON_VERSION = platform.python_version() IS_PY3 = sys.version_info.major >= 3 -TRAVIS = os.environ.get("TRAVIS", False) == "true" -JENKINS = os.environ.get("USER", "") == "jenkins" SUBDIRS = ("gpipe", "optic") @@ -237,7 +235,7 @@ def test_tool(): fn = 'tests/tests.yaml' assert os.path.exists(fn), "tests.yaml does not exist!" - tool_tests = yaml.load(open(fn)) + tool_tests = yaml.safe_load(open(fn)) for test, values in sorted(list(tool_tests.items())): check_script.description = os.path.join(tool_name, test) @@ -248,10 +246,6 @@ def test_tool(): if PYTHON_VERSION.startswith(x)] if len(versions) > 0: continue - if "skip_travis" in values and TRAVIS: - continue - if "skip_jenkins" in values and JENKINS: - continue yield(check_script, test, diff --git a/tests/tests.yaml b/tests/tests.yaml index 6a0e55e6..df9b5452 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -58,7 +58,7 @@ extract_indrop_output_filtered: stdin: indrop.fastq.1.gz outputs: [stdout, indrop_fuzzy_filtered.1.fastq.gz, indrop_fuzzy_filtered.2.fastq.gz] references: [indrop_extract_fuzzy_filtered_out.fastq, indrop_fuzzy_filtered.1.fastq.gz, indrop_fuzzy_filtered.2.fastq.gz] - options: umi_tools extract --extract-method=regex --read2-in=