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

fix: include doctests in the test coverage of code that tarpaulin calculates #533

Merged
merged 20 commits into from Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e485a80
fix: update deprecated alias `--all` to new argument `--workspace`
dlaehnemann Jun 20, 2023
c0b251d
fix: include `doctests` in test coverage calculation, see https://git…
dlaehnemann Jun 20, 2023
bf0be3a
Merge branch 'master' into include-doctests-in-code-coverage-calculation
dlaehnemann Jun 26, 2023
052f09c
try fixing failing doctest compilation during coverage estimation by …
dlaehnemann Jun 26, 2023
57f78b5
make coverage CI step identical to rust-htslib setup
dlaehnemann Jun 26, 2023
046e4d0
remove unused / inexistent tarpaulin option
dlaehnemann Jun 27, 2023
0b7a687
try updating rust-cache action to address save-state deprecation warning
dlaehnemann Jun 27, 2023
7630569
add `--verbose` and `--debug` to tarpaulin, to figure out doctest fai…
dlaehnemann Jun 27, 2023
f9c778c
fix newick doctest
dlaehnemann Jun 28, 2023
490979c
Merge branch 'include-doctests-in-code-coverage-calculation' of githu…
dlaehnemann Jun 28, 2023
7ba5976
remove caching for coverage calculation, as this uses nightly
dlaehnemann Jun 28, 2023
ee7dc77
revert installation of deps that was only added for identical syntax …
dlaehnemann Jun 28, 2023
0bbcb67
remove debugging output from tarpaulin CI step and put `--workspace` …
dlaehnemann Jun 28, 2023
d95dcbe
increase tarpaulin timeout for tests to 5 minutes (instead of 1 minut…
dlaehnemann Jun 28, 2023
e642b2e
increase `--timeout` back to the original 10 minutes
dlaehnemann Jun 28, 2023
1614643
allow tarpaulin multithreading and increase --timeout to 15 minutes
dlaehnemann Jun 28, 2023
a868395
make code coverage CI step run only after successful testing, increas…
dlaehnemann Jun 28, 2023
c9876d2
do not run bio::io::fastq doctests that read from stdin
dlaehnemann Jun 28, 2023
17077eb
exclude all doctests that read from io::stdin() from being run (they …
dlaehnemann Jun 28, 2023
889e87d
reduce tarpaulin --timeout back to 5 minutes, put needs: back to Form…
dlaehnemann Jun 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/rust.yml
Expand Up @@ -116,25 +116,24 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- name: Install cargo-tarpaulin
uses: actions-rs/install@v0.1
- name: Install and run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
crate: cargo-tarpaulin
version: latest
use-tool-cache: true

- name: Coverage with tarpaulin
run: cargo tarpaulin --all --all-features --timeout 600 --out Lcov -- --test-threads 1
# TODO: update to latest tarpaulin once artefact download is fixed: https://github.com/actions-rs/tarpaulin/pull/23
version: "0.22.0"
args: "--workspace --all-features --run-types Tests,Doctests --out Lcov --timeout 300"

- name: Upload coverage
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
6 changes: 3 additions & 3 deletions src/io/fasta.rs
Expand Up @@ -11,7 +11,7 @@
//!
//! In this example, we parse a fasta file from stdin and compute some statistics
//!
//! ```
//! ```no_run
//! use bio::io::fasta;
//! use std::io;
//!
Expand All @@ -34,7 +34,7 @@
//!
//! We can also use a `while` loop to iterate over records.
//! This is slightly faster than the `for` loop.
//! ```
//! ```no_run
//! use bio::io::fasta;
//! use std::io;
//! let mut records = fasta::Reader::new(io::stdin()).records();
Expand Down Expand Up @@ -79,7 +79,7 @@
//!
//! In this example we filter reads from stdin on sequence length and write them to stdout
//!
//! ```
//! ```no_run
//! use bio::io::fasta;
//! use bio::io::fasta::FastaRead;
//! use std::io;
Expand Down Expand Up @@ -371,7 +371,7 @@

/// Open a FASTA index from a given file path.
pub fn from_file<P: AsRef<Path> + std::fmt::Debug>(path: &P) -> anyhow::Result<Self> {
fs::File::open(&path)

Check warning on line 374 in src/io/fasta.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> src/io/fasta.rs:374:24 | 374 | fs::File::open(&path) | ^^^^^ help: change this to: `path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
.map_err(csv::Error::from)
.and_then(Self::new)
.with_context(|| format!("Failed to read fasta index from {:#?}", path))
Expand Down Expand Up @@ -414,7 +414,7 @@
/// present for FASTA ref.fasta.
pub fn from_file<P: AsRef<Path> + std::fmt::Debug>(path: &P) -> anyhow::Result<Self> {
let index = Index::with_fasta_file(path)?;
fs::File::open(&path)

Check warning on line 417 in src/io/fasta.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> src/io/fasta.rs:417:24 | 417 | fs::File::open(&path) | ^^^^^ help: change this to: `path` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
.map(|f| Self::with_index(f, index))
.map_err(csv::Error::from)
.with_context(|| format!("Failed to read fasta from {:#?}", path))
Expand Down
6 changes: 3 additions & 3 deletions src/io/fastq.rs
Expand Up @@ -11,7 +11,7 @@
//!
//! In this example, we parse a fastq file from stdin and compute some statistics
//!
//! ```
//! ```no_run
//! use bio::io::fastq;
//! use std::io;
//! let mut reader = fastq::Reader::new(io::stdin());
Expand All @@ -31,7 +31,7 @@
//! ```
//!
//! We can also use a `while` loop to iterate over records
//! ```
//! ```no_run
//! use bio::io::fastq;
//! use std::io;
//! let mut records = fastq::Reader::new(io::stdin()).records();
Expand Down Expand Up @@ -78,7 +78,7 @@
//!
//! In this example we filter reads from stdin on mean quality (Phred + 33) and write them to stdout
//!
//! ```
//! ```no_run
//! use bio::io::fastq;
//! use bio::io::fastq::FastqRead;
//! use std::io;
Expand Down
2 changes: 1 addition & 1 deletion src/io/gff.rs
Expand Up @@ -11,7 +11,7 @@
//!
//! # Example
//!
//! ```
//! ```no_run
//! // import functions (at top of script)
//! use bio::io::gff;
//! use std::io;
Expand Down
2 changes: 1 addition & 1 deletion src/io/newick.rs
Expand Up @@ -14,7 +14,7 @@
//! use bio::io::newick;
//!
//! let tree = newick::from_string("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;").unwrap();
//! for taxon in tree.raw_nodes() {
//! for taxon in tree.g.raw_nodes() {
//! println!("{}", taxon.weight);
//! }
//! ```
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -95,7 +95,7 @@
//!
//! An example of using `rust-bio`:
//!
//! ```rust
//! ```no_run
//! // Import some modules
//! use bio::alphabets;
//! use bio::data_structures::bwt::{bwt, less, Occ};
Expand Down