File tree Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,4 @@ script.R
3939^cpp4romp$
4040^cpp4rsimplexphase2$
4141^cpp4rtest$
42+ ^badges$
Original file line number Diff line number Diff line change 3535 shell : Rscript {0}
3636
3737 - name : Test coverage
38- run : covr::codecov(quiet = FALSE)
38+ run : |
39+ coverage <- covr::package_coverage(quiet = FALSE)
40+ percent <- round(covr::percent_coverage(coverage))
41+ cat("Coverage:", percent, "%\n")
42+
43+ # Create badge color based on coverage
44+ if (percent >= 90) {
45+ color <- "brightgreen"
46+ } else if (percent >= 80) {
47+ color <- "green"
48+ } else if (percent >= 70) {
49+ color <- "yellowgreen"
50+ } else if (percent >= 60) {
51+ color <- "yellow"
52+ } else if (percent >= 50) {
53+ color <- "orange"
54+ } else {
55+ color <- "red"
56+ }
57+
58+ # Write coverage info to environment
59+ writeLines(paste0("COVERAGE=", percent), Sys.getenv("GITHUB_ENV"))
60+ writeLines(paste0("COVERAGE_COLOR=", color), Sys.getenv("GITHUB_ENV"))
3961 shell : Rscript {0}
62+
63+ - name : Generate coverage badge
64+ run : |
65+ mkdir -p badges
66+ curl -s "https://img.shields.io/badge/coverage-${{ env.COVERAGE }}%25-${{ env.COVERAGE_COLOR }}" > badges/coverage.svg
67+
68+ - name : Commit coverage badge
69+ if : github.ref == 'refs/heads/main'
70+ run : |
71+ git config --local user.email "[email protected] " 72+ git config --local user.name "GitHub Action"
73+ git add badges/coverage.svg
74+ git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]" || true
75+ git push || true
Original file line number Diff line number Diff line change 44[ ![ Lifecycle: stable] ( https://img.shields.io/badge/lifecycle-stable-brightgreen.svg )] ( https://lifecycle.org/articles/stages.html#stable )
55[ ![ R-CMD-check] ( https://github.com/pachadotdev/cpp4r/actions/workflows/R-CMD-check.yaml/badge.svg )] ( https://github.com/pachadotdev/cpp4r/actions/workflows/R-CMD-check.yaml )
66[ ![ CRAN status] ( https://www.r-pkg.org/badges/version/cpp4r )] ( https://CRAN.R-project.org/package=cpp4r )
7- [ ![ Codecov test coverage] ( https://codecov.io/gh/ pachadotdev/cpp4r/branch/ main/graph/badge .svg )] ( https://app.codecov.io/gh/ pachadotdev/cpp4r?branch=main )
7+ [ ![ Test coverage] ( https://raw.githubusercontent.com/ pachadotdev/cpp4r/main/badges/coverage .svg )] ( https://github.com/ pachadotdev/cpp4r/actions/workflows/test-coverage.yaml )
88[ ![ BuyMeACoffee] ( https://raw.githubusercontent.com/pachadotdev/buymeacoffee-badges/main/bmc-yellow.svg )] ( https://www.buymeacoffee.com/pacha )
99<!-- badges: end -->
1010
You can’t perform that action at this time.
0 commit comments