Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevOps: Code Coverage #4

Merged
merged 2 commits into from
Sep 6, 2020
Merged

DevOps: Code Coverage #4

merged 2 commits into from
Sep 6, 2020

Conversation

avisionh
Copy link
Contributor

@avisionh avisionh commented Aug 20, 2020

Summary

This branch implements best DevOps practice in setting-up code coverage. This is a measurement of how many lines of code are executed while automated tests are running. In this regard, it is a good metric for how much testing is being done and consequently, how much of your code is being checked for errors or failures.

More information is provided on this StackOverflow post.

It uses the covr package.

Typically, this is used alongside software testing.

Changes

The changes made in this PR are:

  1. covr package added to repo (via DESCRIPTION)
  2. Code report has been pushed up to codecov.io

Check

  • A report is generated here
  • Can generate a report by running locally covr::report()
    • You will probably need to install the following packages first: install.packages(pkgs = c('covr', 'DT'), Ncpus = 1)
    • Tip: You can set the Ncpus argument to the number of cores on your machine to speed up the installation of packages. I usually set Ncpus = parallel::detectCores() - 1 so that I have one core left to do other stuff on my machine.

Note

Currently are not testing any of our code, so we expect code coverage to be 0%.

This is usually employed alongside testthat.

This branch is rebased off devops/precommit so some of the file changes currently seen in this branch are not actually relevant. They will disappear when #3 gets merged into the main branch.

@avisionh avisionh self-assigned this Aug 20, 2020
@avisionh avisionh marked this pull request as ready for review August 21, 2020 17:16
@martinctc
Copy link
Contributor

@avisionh We don't currently have a README or the Travis checks set up - they come from the other branch (devops/ci-cd) presumably? #5

To see if the code coverage is properly set up, do you think we should re-base the branch?

This is to show we are using code coverage.
This is so we can cover the testing on our code.
@avisionh
Copy link
Contributor Author

avisionh commented Aug 31, 2020

@avisionh We don't currently have a README or the Travis checks set up - they come from the other branch (devops/ci-cd) presumably? #5

To see if the code coverage is properly set up, do you think we should re-base the branch?

Yup, need to rebase off main since that has the code coverage badge in the README. (Technically, i should have added it here.) Done that now.

Good spot! The Travis checks will come in the separate branch that you already referred to so I should probably take that out of the checks at the top, thanks!

@martinctc martinctc merged commit 11615a8 into main Sep 6, 2020
@martinctc martinctc deleted the devops/code-coverage branch September 6, 2020 17:20
@avisionh
Copy link
Contributor Author

Review PR: Code Coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants