From aa5045c8bb5feca1d74e12e621eafbc84bf5b522 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 17 Nov 2024 15:48:05 +0100 Subject: Test coverage using github workflow With the current travis configuration, installation of covr failed, presumably because of the use of the Xenial distribution which is rather outdated meanwhile. The error occurred when installation of curl was attempted on travis: Error: C++17 standard requested but CXX17 is not defined --- .Rbuildignore | 2 ++ .github/.gitignore | 1 + .github/workflows/test-coverage.yaml | 61 ++++++++++++++++++++++++++++++++++++ .travis.yml | 4 --- README.md | 2 +- codecov.yml | 14 +++++++++ 6 files changed, 79 insertions(+), 5 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 f0b4d3d..f84e599 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,5 @@ README.html .travis.yml experimental test.log$ +^codecov\.yml$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /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 0000000..e050312 --- /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: + +name: test-coverage.yaml + +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 if error if not on PR, or if on PR and token is given + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} + 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 712829e..862f118 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,3 @@ cache: packages r: - release - devel -github_packages: - - r-lib/covr -after_success: - - Rscript -e 'covr::codecov()' diff --git a/README.md b/README.md index fcb931f..758952d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![](https://www.r-pkg.org/badges/version/chemCal)](https://cran.r-project.org/package=chemCal) [![Build Status](https://app.travis-ci.com/jranke/chemCal.svg?token=Sq9VuYWyRz2FbBLxu6DK&branch=main)](https://app.travis-ci.com/jranke/chemCal) -[![codecov](https://codecov.io/github/jranke/chemCal/branch/master/graphs/badge.svg)](https://codecov.io/github/jranke/chemCal) +[![Codecov test coverage](https://codecov.io/gh/jranke/chemCal/graph/badge.svg)](https://app.codecov.io/gh/jranke/chemCal) ## Overview diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..04c5585 --- /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.3 From 77759ea63aa724d87cf3cc1b41bb14f5209f8725 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 17 Nov 2024 16:10:36 +0100 Subject: Bump date to check codecov config On codecov.io, I changed the settings not to require an upload token. Hopefully this restores coverage reports. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9961bec..ebb9a83 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: chemCal Version: 0.2.3.9000 -Date: 2022-04-01 +Date: 2024-11-17 Title: Calibration Functions for Analytical Chemistry Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "johannes.ranke@jrwb.de", -- cgit v1.2.3 From b10d246720105125395b6842adc8c985231ad515 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 17 Nov 2024 16:58:19 +0100 Subject: Give up on travis, check with github actions --- .github/workflows/R-CMD-check.yaml | 51 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 5 ---- README.md | 1 + 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..562fe0f --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,51 @@ +# 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: + +name: R-CMD-check.yaml + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 862f118..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: r -cache: packages -r: - - release - - devel diff --git a/README.md b/README.md index 758952d..cf11326 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![Build Status](https://app.travis-ci.com/jranke/chemCal.svg?token=Sq9VuYWyRz2FbBLxu6DK&branch=main)](https://app.travis-ci.com/jranke/chemCal) [![Codecov test coverage](https://codecov.io/gh/jranke/chemCal/graph/badge.svg)](https://app.codecov.io/gh/jranke/chemCal) +[![R-CMD-check](https://github.com/jranke/chemCal/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jranke/chemCal/actions/workflows/R-CMD-check.yaml) ## Overview -- cgit v1.2.3 From afc256aa52f77e20e215e947d2aa061dccb682e5 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 17 Nov 2024 17:02:43 +0100 Subject: Reduce test matrix to save energy I do not expect relevant platform dependent behaviour in this package --- .github/workflows/R-CMD-check.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 562fe0f..1429649 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -20,10 +20,10 @@ jobs: matrix: config: - {os: macos-latest, r: 'release'} - - {os: windows-latest, r: 'release'} + #- {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel-1'} + #- {os: ubuntu-latest, r: 'release'} + # - {os: ubuntu-latest, r: 'oldrel-1'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} -- cgit v1.2.3