diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 5c87002c3..d85ddda76 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,13 +23,13 @@ jobs: uses: Swatinem/rust-cache@v2.3.0 - name: Prepare runner - run: cargo xtask cov install + run: cargo xtask cov install -v - name: Generate PR report if: github.event.number != '' env: GH_TOKEN: ${{ secrets.DEVOLUTIONSBOT_TOKEN != '' && secrets.DEVOLUTIONSBOT_TOKEN || github.token }} - run: cargo xtask cov report-gh --repo "${{ github.repository }}" --pr "${{ github.event.number }}" + run: cargo xtask cov report-gh --repo "${{ github.repository }}" --pr "${{ github.event.number }}" -v - name: Configure Git Identity if: github.ref == 'refs/heads/master' @@ -41,4 +41,4 @@ jobs: if: github.ref == 'refs/heads/master' env: GH_TOKEN: ${{ secrets.DEVOLUTIONSBOT_TOKEN }} - run: cargo xtask cov update + run: cargo xtask cov update -v diff --git a/xtask/src/cov.rs b/xtask/src/cov.rs index 287adf03b..89fd5fb3c 100644 --- a/xtask/src/cov.rs +++ b/xtask/src/cov.rs @@ -81,6 +81,7 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> { use std::fmt::Write as _; const COMMENT_HEADER: &str = "## Coverage Report :robot: :gear:"; + const DIFF_THRESHOLD: f64 = 0.005; let _s = Section::new("COV-REPORT"); @@ -91,7 +92,7 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> { println!("Past:\n{past_report}"); println!("New:\n{report}"); - println!("Diff: {:+.2}%", diff); + println!("Diff: {:+}%", diff); let comments = cmd!(sh, "gh api") .arg("-H") @@ -137,7 +138,8 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> { .arg(format!("/repos/{repo}/issues/comments/{comment_id}")) .ignore_stdout() .run()?; - } else if diff.abs() < 0.01 { + } else if diff.abs() > DIFF_THRESHOLD { + trace!("Diff ({diff}) is greater than threshold ({DIFF_THRESHOLD})"); println!("Create new comment"); command