Skip to content

Merge pull request #532 from merfort/update_scenariomip_mapping #1249

Merge pull request #532 from merfort/update_scenariomip_mapping

Merge pull request #532 from merfort/update_scenariomip_mapping #1249

Workflow file for this run

name: check
on:
push:
branches: [main, master]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main, master]
jobs:
check:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
extra-repositories: "https://rse.pik-potsdam.de/r/packages"
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
lucode2
covr
madrat
magclass
citation
gms
goxygen
GDPuc
# piam packages also available on CRAN (madrat, magclass, citation,
# gms, goxygen, GDPuc) will usually have an outdated binary version
# available; by using extra-packages we get the newest version
- name: Run pre-commit checks
shell: bash
run: |
python -m pip install pre-commit
python -m pip freeze --local
pre-commit run --show-diff-on-failure --color=always --all-files
- name: Verify validation key
shell: Rscript {0}
run: lucode2:::validkey(stopIfInvalid = TRUE)
- name: Verify that lucode2::buildLibrary was successful
if: github.event_name == 'pull_request'
shell: Rscript {0}
run: lucode2:::isVersionUpdated()
- name: Checks
shell: Rscript {0}
run: |
options(crayon.enabled = TRUE)
lucode2::check(runLinter = FALSE)
- name: Test coverage
if: ${{ github.event_name != 'pull_request' }}
shell: Rscript {0}
run: |
nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps"))
if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) {
coverage <- covr::package_coverage(quiet = FALSE)
# The following function might be unnecessary if r-lib/covr#616 gets merged
to_simple_codecov <- function(coverage) {
fullLineCoverage <- covr:::per_line(coverage)
data <- Map(function(fileCoverage) {
resultCoverage <- lapply(fileCoverage$coverage, jsonlite::unbox)
names(resultCoverage) <- seq_along(resultCoverage)
return(resultCoverage)
}, fullLineCoverage)
return(jsonlite::toJSON(list("coverage" = data), na = "null"))
}
writeLines(to_simple_codecov(coverage), "simple-codecov.json")
}
env:
NOT_CRAN: "true"
- uses: codecov/codecov-action@v4
if: ${{ github.event_name != 'pull_request' }}
with:
file: ./simple-codecov.json
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}