diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2024-11-17 15:48:05 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2024-11-17 15:48:05 +0100 |
commit | aa5045c8bb5feca1d74e12e621eafbc84bf5b522 (patch) | |
tree | 18b21879671a8c4901a0083afd98762a8ad4e72e /.github/workflows | |
parent | d202b127909669c484bc74bb87d629f9e3bea299 (diff) |
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
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/test-coverage.yaml | 61 |
1 files changed, 61 insertions, 0 deletions
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 |