diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 2eb3ede..dc14eed 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -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 @@ -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 diff --git a/R/remotebmi/README.md b/R/remotebmi/README.md index 245474b..ae46cb8 100644 --- a/R/remotebmi/README.md +++ b/R/remotebmi/README.md @@ -104,4 +104,4 @@ array([0, 0]) # Other grid function not needed for walrus # And finally client.finalize() -``` \ No newline at end of file +``` diff --git a/README.md b/README.md index aa9f9f6..5452660 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..dc5f2b0 --- /dev/null +++ b/codecov.yml @@ -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/**