0

I try to test code coverage of my R package. However, after Travis-CI build succeeds, it shows an error message that the R package I test does not contain covr package as follow: Error: ‘/home/travis/build/tzuliu/ooc’ does not contain a package! Execution halted

I have tried several instructions, such as this instruction or this instruction. However, it still fails.

My Travis yml file is as follows:

sudo: false
language: r
cache: packages
install:
 - Rscript -e 'install.packages(c("devtools","roxygen2","testthat"));devtools::install_deps("ooc")'
script:
 - Rscript -e 'devtools::check("ooc")'
r_packages:
 - covr  
r_github_packages:
 - r-lib/covr
after_success:
 - Rscript -e 'covr::codecov()'

Can anybody help identify where the issue is?

Note: The system is OSX and I have followed the instruction to revise DESCRIPTION .

tzu
  • 183
  • 1
  • 9
  • Change your working directory to one level higher with `setwd("/home/travis/build/tzuliu/")` and then run the coverage – epo3 Apr 02 '18 at 19:16
  • @epo3 Thanks for your comment. I have tried to put `-Rscript -e setwd("/home/travis/build/tzuliu/")` under `after_success:` before `- Rscript -e 'covr::codecov()'` but it doesn't work. Where should I put this line? Thanks again! – tzu Apr 02 '18 at 19:41
  • run it from the command line. try this tutorial that I wrote some time ago: https://walczak.org/2017/06/how-to-add-code-coverage-codecov-to-your-r-package/ – epo3 Apr 03 '18 at 13:20

1 Answers1

0

Replace the last line with this

- Rscript -e 'covr::codecov(<path to the R-package>)'
Anirudh
  • 52
  • 1
  • 7