From 046b85109be97f98b80fb929bebfea2c75e591d2 Mon Sep 17 00:00:00 2001 From: Christopher Tomkins-Tinch Date: Tue, 4 Jun 2024 09:18:02 -0400 Subject: [PATCH] update coveralls action; bump actions python to 3.10 --- .coveragerc | 3 +-- .github/workflows/build.yml | 17 ++++++++--------- .gitignore | 3 ++- README.md | 5 +---- conftest.py | 4 ++++ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.coveragerc b/.coveragerc index 6315a274..677d1d14 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,13 +1,12 @@ # .coveragerc to control test coverage report -# source is not used here because it is specified in pytest.ini [run] branch = True omit = tools/conda-tools/* disable_warnings = module-not-imported +relative_files = True [report] - exclude_lines = pragma: no cover diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33d764d9..55f058a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,7 +125,7 @@ jobs: fi echo "Building with cache from: $_CACHE_FROM" - docker build -t local/build-container:build $_CACHE_FROM . + docker build --squash -t local/build-container:build $_CACHE_FROM . - name: Deploy docker image run: | github_actions_ci/deploy-docker.sh @@ -138,8 +138,8 @@ jobs: needs: build_docker runs-on: ubuntu-20.04 env: - GITHUB_ACTIONS_PYTHON_VERSION: 3.8 - PYTEST_ADDOPTS: "-rsxX -n 2 --durations=25 --fixture-durations=10 --junit-xml=pytest.xml --cov-report= --cov kmer_utils --cov metagenomics --cov taxon_filter --cov classify" + GITHUB_ACTIONS_PYTHON_VERSION: "3.10" + PYTEST_ADDOPTS: "-rsxX --durations=25 --fixture-durations=10 --junit-xml=pytest.xml --cov-config=.coveragerc --cov-report xml:coverage.xml --cov-report= --cov kmer_utils --cov metagenomics --cov taxon_filter --cov classify" steps: - name: checkout repository uses: actions/checkout@v3 @@ -186,12 +186,11 @@ jobs: mkdir coverage - name: test with docker run: | - docker run -e _JAVA_OPTIONS -e PYTEST_ADDOPTS -v `pwd`/coverage:/coverage -v `pwd`/test:/opt/viral-ngs/source/test --entrypoint /bin/bash $DOCKER_TAG -c 'set -e; cd /opt/viral-ngs/source; pytest test/unit; cp .coverage /coverage' - - name: run coveralls - run: | - mv coverage/.coverage . - pip install coveralls>=1.3.0 - coveralls --service=github + docker run -e _JAVA_OPTIONS -e PYTEST_ADDOPTS -v `pwd`/.coveragerc:/opt/viral-ngs/source/.coveragerc -v `pwd`/coverage:/coverage -v `pwd`/test:/opt/viral-ngs/source/test --entrypoint /bin/bash $DOCKER_TAG -c 'set -e; cd /opt/viral-ngs/source; pytest -n $(nproc) test/unit; cp coverage.xml /coverage;' + - name: Run coveralls + uses: coverallsapp/github-action@v2 + with: + file: coverage/coverage.xml ## note: this test_docs job does not actually produce the output on readthedocs ## readthedocs does its own build trigger. this job exists simply to alert us diff --git a/.gitignore b/.gitignore index 5a3e21a7..eb898c12 100644 --- a/.gitignore +++ b/.gitignore @@ -53,7 +53,8 @@ htmlcov/ nosetests.xml pytest.xml coverage.xml -.coverage* +.coverage +coverage/ test/input/TestVPhaser2/in.bam.bti diff --git a/README.md b/README.md index 53b9fb0b..6a468cab 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ [![Docker Repository on Quay](https://quay.io/repository/broadinstitute/viral-classify/status "Docker Repository on Quay")](https://quay.io/repository/broadinstitute/viral-classify) [![Build Status](https://github.com/broadinstitute/viral-classify/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/broadinstitute/viral-classify/actions) [![Documentation Status](https://readthedocs.org/projects/viral-classify/badge/?version=latest)](https://viral-classify.readthedocs.io/en/latest/?badge=latest) - +[![Coverage Status](https://coveralls.io/repos/github/broadinstitute/viral-classify/badge.svg)](https://coveralls.io/github/broadinstitute/viral-classify) viral-classify ========= diff --git a/conftest.py b/conftest.py index 87bd0dc6..fecbbbd1 100644 --- a/conftest.py +++ b/conftest.py @@ -43,6 +43,10 @@ def pytest_configure(config): reporter = FixtureReporter(config) config.pluginmanager.register(reporter, 'fixturereporter') + config.addinivalue_line( + "markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')" + ) + def pytest_collection_modifyitems(config, items): if config.getoption("--runslow"):