From db43ba615c9084963f743df86512bd92ac88c8af Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 28 Jul 2024 18:56:54 +0200 Subject: Move coverage report from travis to github actions --- .Rbuildignore | 2 ++ .github/.gitignore | 1 + .github/workflows/test-coverage.yaml | 61 ++++++++++++++++++++++++++++++++++++ .travis.yml | 3 -- README.md | 5 ++- codecov.yml | 14 +++++++++ 6 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/test-coverage.yaml create mode 100644 codecov.yml diff --git a/.Rbuildignore b/.Rbuildignore index e7cbe786..1a243475 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -35,3 +35,5 @@ ^vignettes/web_only/.*$ ^.*\.Rproj$ ^\.Rproj\.user$ +^codecov\.yml$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 00000000..2d19fc76 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 00000000..fefc52e2 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,61 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: test-coverage + +permissions: read-all + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr, any::xml2 + needs: coverage + + - name: Test coverage + 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: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find '${{ runner.temp }}/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 }}/package diff --git a/.travis.yml b/.travis.yml index 61b56979..006ba521 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,3 @@ script: after_failure: - ./run.sh dump_logs - -after_success: - - travis_wait 40 ./run.sh coverage diff --git a/README.md b/README.md index 98e3d0a7..dee59ed9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # mkin + [![](https://www.r-pkg.org/badges/version/mkin)](https://cran.r-project.org/package=mkin) [![mkin status badge](https://jranke.r-universe.dev/badges/mkin)](https://jranke.r-universe.dev/ui/#package:mkin) [![Build Status](https://app.travis-ci.com/jranke/mkin.svg?token=Sq9VuYWyRz2FbBLxu6DK&branch=main)](https://app.travis-ci.com/jranke/mkin) -[![codecov](https://codecov.io/github/jranke/mkin/branch/main/graphs/badge.svg)](https://app.codecov.io/gh/jranke/mkin) +[![Codecov test coverage](https://codecov.io/gh/jranke/mkin/branch/main/graph/badge.svg)](https://app.codecov.io/gh/jranke/mkin?branch=main) + + The [R](https://www.r-project.org) package **mkin** provides calculation routines for the analysis of chemical degradation data, including multicompartment kinetics as diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..04c55859 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true -- cgit v1.2.1