Skip to content

Commit

Permalink
Add test coverage with codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Oct 7, 2024
1 parent 3d7c3f8 commit e43f8ba
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 6 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write # This is required for requesting the JWT

jobs:
r:
runs-on: ubuntu-latest
Expand All @@ -23,13 +26,43 @@ jobs:
with:
sparse-checkout: |
R/remotebmi
path: root
- name: Move R package to cwd
run: shopt -s dotglob && mv root/R/remotebmi/* . && rm -rf root
- name: Setup R
uses: r-lib/actions/setup-r@v2
working-directory: R/remotebmi
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
extra-packages: any::rcmdcheck, any::covr, any::xml2
needs: check, coverage
working-directory: R/remotebmi
- uses: r-lib/actions/check-r-package@v2
working-directory: R/remotebmi
- name: Test coverage
working-directory: R/remotebmi
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./R/remotebmi/cobertura.xml
plugin: noop
disable_search: true
use_oidc: true
- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/R/remotebmi/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/R/remotebmi/package
2 changes: 1 addition & 1 deletion R/remotebmi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ array([0, 0])
# Other grid function not needed for walrus
# And finally
client.finalize()
```
```
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Remote BMI

[![Codecov test coverage](https://codecov.io/gh/eWaterCycle/remotebmi/graph/badge.svg)](https://app.codecov.io/gh/eWaterCycle/remotebmi)

The [Basic Model Interface (BMI)](https://bmi.readthedocs.io/en/stable/) is a standard interface for models.
The interface is available in different languages and a [language agnosting version in SIDL](https://github.com/csdms/bmi/blob/stable/bmi.sidl).
Expand Down
20 changes: 20 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
comment:
layout: "header, diff, flags, components" # show component info in the PR comment

component_management:
default_rules: # default rules that will be inherited by all components
statuses:
- type: project # in this case every component that doens't have a status defined will have a project type one
target: auto
branches:
- "!main"
individual_components:
- component_id: Python
paths:
- python/**
- component_id: Julia
paths:
- RemoteBMI.jl/**
- component_id: R
paths:
- R/remotebmi/**

0 comments on commit e43f8ba

Please sign in to comment.