Skip to content

Commit b50cf04

Browse files
authored
Merge pull request #235 from codeZeilen/feature/coverage-limit-to-master
Fixes coverage reporting and limits it to main branches only
2 parents 00fe633 + 1d0da59 commit b50cf04

File tree

6 files changed

+55
-11
lines changed

6 files changed

+55
-11
lines changed

.buildlibrary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ValidationKey: '10495100'
1+
ValidationKey: '10569520'
22
AutocreateReadme: yes
33
AutocreateCITATION: yes
44
AcceptedWarnings:

.github/workflows/check.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,31 @@ jobs:
6060
lucode2::check(runLinter = FALSE)
6161
6262
- name: Test coverage
63+
if: ${{ github.event_name != 'pull_request' }}
6364
shell: Rscript {0}
6465
run: |
6566
nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps"))
66-
if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) covr::codecov(quiet = FALSE)
67+
if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) {
68+
coverage <- covr::package_coverage(quiet = FALSE)
69+
# The following function might be unnecessary if r-lib/covr#616 gets merged
70+
to_simple_codecov <- function(coverage) {
71+
fullLineCoverage <- covr:::per_line(coverage)
72+
data <- Map(function(fileCoverage) {
73+
resultCoverage <- lapply(fileCoverage$coverage, jsonlite::unbox)
74+
names(resultCoverage) <- seq_along(resultCoverage)
75+
return(resultCoverage)
76+
}, fullLineCoverage)
77+
return(jsonlite::toJSON(list("coverage" = data), na = "null"))
78+
}
79+
writeLines(to_simple_codecov(coverage), "simple-codecov.json")
80+
}
6781
env:
6882
NOT_CRAN: "true"
83+
84+
- uses: codecov/codecov-action@v4
85+
if: ${{ github.event_name != 'pull_request' }}
86+
with:
87+
file: ./simple-codecov.json
88+
plugin: noop
89+
disable_search: true
90+
token: ${{ secrets.CODECOV_TOKEN }}

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ cff-version: 1.2.0
22
message: If you use this software, please cite it using the metadata from this file.
33
type: software
44
title: 'lucode2: Code Manipulation and Analysis Tools'
5-
version: 0.51.7
6-
date-released: '2025-07-31'
5+
version: 0.52.0
6+
date-released: '2025-08-26'
77
abstract: A collection of tools which allow to manipulate and analyze code.
88
authors:
99
- family-names: Dietrich

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: lucode2
33
Title: Code Manipulation and Analysis Tools
4-
Version: 0.51.7
5-
Date: 2025-07-31
4+
Version: 0.52.0
5+
Date: 2025-08-26
66
Authors@R: c(
77
person("Jan Philipp", "Dietrich", , "[email protected]", role = c("aut", "cre"),
88
comment = c(affiliation = "Potsdam Institute for Climate Impact Research", ORCID = "0000-0002-4309-6431")),

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code Manipulation and Analysis Tools
22

3-
R package **lucode2**, version **0.51.7**
3+
R package **lucode2**, version **0.52.0**
44

55
[![CRAN status](https://www.r-pkg.org/badges/version/lucode2)](https://cran.r-project.org/package=lucode2) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4389418.svg)](https://doi.org/10.5281/zenodo.4389418) [![R build status](https://github.com/pik-piam/lucode2/workflows/check/badge.svg)](https://github.com/pik-piam/lucode2/actions) [![codecov](https://codecov.io/gh/pik-piam/lucode2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/lucode2) [![r-universe](https://pik-piam.r-universe.dev/badges/lucode2)](https://pik-piam.r-universe.dev/builds)
66

@@ -39,7 +39,7 @@ In case of questions / problems please contact Jan Philipp Dietrich <dietrich@pi
3939

4040
To cite package **lucode2** in publications use:
4141

42-
Dietrich J, Sauer P, Klein D, Giannousakis A, Bonsch M, Bodirsky B, Baumstark L, Richters O, Pflüger M (2025). "lucode2: Code Manipulation and Analysis Tools." doi:10.5281/zenodo.4389418 <https://doi.org/10.5281/zenodo.4389418>, Version: 0.51.7, <https://github.com/pik-piam/lucode2>.
42+
Dietrich J, Sauer P, Klein D, Giannousakis A, Bonsch M, Bodirsky B, Baumstark L, Richters O, Pflüger M (2025). "lucode2: Code Manipulation and Analysis Tools." doi:10.5281/zenodo.4389418 <https://doi.org/10.5281/zenodo.4389418>, Version: 0.52.0, <https://github.com/pik-piam/lucode2>.
4343

4444
A BibTeX entry for LaTeX users is
4545

@@ -48,9 +48,9 @@ A BibTeX entry for LaTeX users is
4848
title = {lucode2: Code Manipulation and Analysis Tools},
4949
author = {Jan Philipp Dietrich and Pascal Sauer and David Klein and Anastasis Giannousakis and Markus Bonsch and Benjamin Leon Bodirsky and Lavinia Baumstark and Oliver Richters and Mika Pflüger},
5050
doi = {10.5281/zenodo.4389418},
51-
date = {2025-07-31},
51+
date = {2025-08-26},
5252
year = {2025},
5353
url = {https://github.com/pik-piam/lucode2},
54-
note = {Version: 0.51.7},
54+
note = {Version: 0.52.0},
5555
}
5656
```

inst/extdata/check.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,31 @@ jobs:
6060
lucode2::check(runLinter = FALSE)
6161
6262
- name: Test coverage
63+
if: ${{ github.event_name != 'pull_request' }}
6364
shell: Rscript {0}
6465
run: |
6566
nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps"))
66-
if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) covr::codecov(quiet = FALSE)
67+
if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) {
68+
coverage <- covr::package_coverage(quiet = FALSE)
69+
# The following function might be unnecessary if r-lib/covr#616 gets merged
70+
to_simple_codecov <- function(coverage) {
71+
fullLineCoverage <- covr:::per_line(coverage)
72+
data <- Map(function(fileCoverage) {
73+
resultCoverage <- lapply(fileCoverage$coverage, jsonlite::unbox)
74+
names(resultCoverage) <- seq_along(resultCoverage)
75+
return(resultCoverage)
76+
}, fullLineCoverage)
77+
return(jsonlite::toJSON(list("coverage" = data), na = "null"))
78+
}
79+
writeLines(to_simple_codecov(coverage), "simple-codecov.json")
80+
}
6781
env:
6882
NOT_CRAN: "true"
83+
84+
- uses: codecov/codecov-action@v4
85+
if: ${{ github.event_name != 'pull_request' }}
86+
with:
87+
file: ./simple-codecov.json
88+
plugin: noop
89+
disable_search: true
90+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)