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

Start parsing the chunks file with serde #31

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
fix CI failures
  • Loading branch information
Swatinem committed Nov 19, 2024
commit 56391d0432fd457760cca67a2bfb840b105ceaca
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -58,6 +58,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true

- run: rustup toolchain install stable --profile minimal --no-self-update
- uses: Swatinem/rust-cache@v2
2 changes: 2 additions & 0 deletions core/src/parsers/pyreport/chunks.rs
Original file line number Diff line number Diff line change
@@ -46,6 +46,8 @@ use serde::{de, Deserialize};
use super::report_json::ParsedReportJson;
use super::utils;
use crate::error::CodecovError;
#[cfg(doc)]
use crate::report::models;
use crate::report::pyreport::types::{
self, CoverageType, MissingBranch, Partial, PyreportCoverage, ReportLine,
};
10 changes: 6 additions & 4 deletions core/src/parsers/pyreport/mod.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ use std::fs::File;
use memmap2::Mmap;

use crate::error::Result;
#[cfg(doc)]
use crate::report::models;
use crate::report::SqliteReportBuilder;

pub mod chunks;
@@ -18,14 +20,14 @@ mod utils;
/// - Chunks file, which describes line-by-line coverage data for each file
///
/// The parser for the report JSON inserts a
/// [`crate::report::models::SourceFile`] for each file
/// and a [`crate::report::models::Context`] for each session. It returns two
/// [`SourceFile`](models::SourceFile) for each file
/// and a [`Context`](models::Context) for each session. It returns two
/// hashmaps: one which maps each file's "chunk index" to the database PK for
/// the `SourceFile` that was inserted for it, and one which maps each session's
/// the [`SourceFile`](models::SourceFile) that was inserted for it, and one which maps each session's
/// "session_id" to the database PK for the `Context` that was inserted for it.
///
/// The parser for the chunks file inserts a
/// [`crate::report::models::CoverageSample`] (and possibly other records) for
/// [`CoverageSample`](models::CoverageSample) (and possibly other records) for
/// each coverage measurement contained in the chunks file. It uses the
/// results of the report JSON parser to figure out the appropriate FKs to
/// associate a measurement with its `SourceFile` and `Context`(s).
Loading
Oops, something went wrong.