Skip to content

Impove test coverage #165

Impove test coverage

Impove test coverage #165

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: CI
on:
pull_request:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
defaults:
run:
shell: bash -el {0}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: [3.12] #["3.8", "3.9", "3.10"]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# # Always create the environment (but use cached packages when available)
# - name: Setup conda environment
# uses: conda-incubator/setup-miniconda@v3
# with:
# python-version: ${{ matrix.python-version }}
# channels: conda-forge,bioconda
# environment-file: binette.yaml
# activate-environment: binette
# conda-remove-defaults: true
- name : Setup micromamba environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: binette.yaml
create-args: python=${{ matrix.python-version }}
cache-environment: true
- name: Install binette
run: |
pip install .
binette -h
- name: Download test data
uses: actions/checkout@v3
with:
repository: genotoul-bioinfo/Binette_TestData
path: test_data
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest --cov=binette --cov-report=html --cov-report=xml --cov-report=term -v --test-data-path="test_data/"
- name: Generate coverage badge
run: |
pip install genbadge[coverage]
genbadge coverage -i coverage.xml -o htmlcov/coverage-badge.svg
rm htmlcov/.gitignore
- name: Publish coverage report to GitHub Pages
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: htmlcov
branch: gh-pages
- name: Run simple test case from bin2table
run: |
cd test_data
binette -b binning_results/*binning --contigs all_contigs.fna --checkm2_db checkm2_tiny_db/checkm2_tiny_db.dmnd -v -o test_results
- name: Compare results from bin2table with expectation
run: |
cd test_data
head ../tests/expected_results/final_bins_quality_reports.tsv test_results/final_bins_quality_reports.tsv
python scripts/compare_results.py ../tests/expected_results/final_bins_quality_reports.tsv test_results/final_bins_quality_reports.tsv