From b0a858dfd72799bf09ac57b2e8a6d7f8f75594c4 Mon Sep 17 00:00:00 2001 From: Tomer <iwantomer@hotmail.com> Date: Sat, 23 Mar 2024 10:49:26 +0100 Subject: [PATCH] feat: codecoverage workflow --- .Rbuildignore | 1 + .github/workflows/test-coverage.yaml | 50 ++++++++++++++++++++++++++++ README.md | 4 ++- codecov.yml | 14 ++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-coverage.yaml create mode 100644 codecov.yml diff --git a/.Rbuildignore b/.Rbuildignore index 9f17337..f943828 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -12,3 +12,4 @@ ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^codecov\.yml$ diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..21b8a93 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,50 @@ +# 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 + +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 + needs: coverage + + - name: Test coverage + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + shell: Rscript {0} + + - 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/README.md b/README.md index 4807f09..b89cb2b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # polyglotr <a href='https://github.com/Tomeriko96/polyglotr'><img src="man/figures/hex-polyglotr.png" style="float:right; height:200px;" height="200" align="right"/></a> -[](https://www.codefactor.io/repository/github/Tomeriko96/polyglotr) [](https://github.com/Tomeriko96/polyglotr/actions/workflows/R-CMD-check.yaml) [](https://CRAN.R-project.org/package=polyglotr/) <a href="https://diffify.com/R/polyglotr" target="_blank"><img src="https://diffify.com/diffify-badge.svg" alt="The diffify page for the R package polyglotr" style="width: 100px; max-width: 100%;"/></a> [](https://cran.r-project.org/package=polyglotr/) [](https://cran.r-project.org/package=polyglotr/) +[](https://www.codefactor.io/repository/github/Tomeriko96/polyglotr) +[](https://app.codecov.io/gh/tomeriko96/polyglotr?branch=main) +[](https://github.com/Tomeriko96/polyglotr/actions/workflows/R-CMD-check.yaml) [](https://CRAN.R-project.org/package=polyglotr/) <a href="https://diffify.com/R/polyglotr" target="_blank"><img src="https://diffify.com/diffify-badge.svg" alt="The diffify page for the R package polyglotr" style="width: 100px; max-width: 100%;"/></a> [](https://cran.r-project.org/package=polyglotr/) [](https://cran.r-project.org/package=polyglotr/) R package to translate text. 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