You can install netR
from GitHub:
install.packages("devtools")
devtools::install_github("BenaroyaResearch/netR")
Repository uses Github Actions and codecov. See badges above.
renv
is an R package for dependency management.
renv helps keep
same versions of packages used for all collaborators.
It is
encouraged to keep netR
dependencies as few as possible (0 dependency
and light-weight data.table
for data manipulation is recommended).
There are 2 workflows in GH Actions: R-CMD-check
and test-coverage
.
After each push to the remote repository, automated checks are
performed. R CMD Check
runs all package unit tests and checks if the
package can be installed on most popular platforms - MacOS, Windows and
Linux.
Code coverage reports are generated for main
branch only.
To measure test coverage of netR
codebase, covr
package is used (See
workflows in GitHub Actions).
This Readme is generated from README.Rmd
. To update this file, modify
.Rmd
file in the package and rebuild using:
devtools::build_readme()
or knit README.Rmd
- Cmd + Shift + Enter
(Windows Ctrl + Shift + Enter
).
-
Clone the repository
git clone https://github.com/BenaroyaResearch/netR.git
-
Create a development branch with name indicating what changes the branch is going to introduce -
git checkout -b <branch_name>
-
Open
netR.Rproj
file and callrenv::restore()
. This updates packages versions to the ones that are specified inrenv.lock
file. If needed, packages will be installed. This applies only to thenetR
project on your machine. If you need to install and use another package, useinstall.packages()
and then updaterenv.lock
file usingrenv::snapshot()
(so the next person canrenv::resotre()
). If you face troubles installing packages when usingrenv
, you might need change the download method withSys.setenv(RENV_DOWNLOAD_METHOD = "libcurl")
forlibcurl
orwininet
. -
Add
.R
file with a new function(s) or add to an existing file -
Add unit tests (recommended)
-
Run
devtools::document()
to update functions’man
files andNAMESPACE
,
devtools::test()
to run your unit test and check if they all pass anddevtools::check()
to runR CMD check
locally. If unit tests and cmd-check is not run locally, it will be run by GitHub anyway. -
Increment version in
DESCRIPTION
file and add new line tover_log.md
file. If this is your first contribution to the package, remember to add yourself toAuthor
field inDESCRIPTION
file. -
Push your code to remote:
git push -u origin <branch_name>
-
Open a Pull Request for your branch. After passing
R-CMD-check
and getting approval from other collaborator, merge your development branch intomain
-
Switch to
main
branch withgit checkout main
and sync your local with remote branch usinggit pull origin main
main
is a protected branch, meaning that you cannot push directly to
it. To merge code you should create a pull request from your
development branch. At least one reviewer needs to approve your PR to
be able to merge into main
.
All required GitHub Actions
workflows must pass (R-CMD-check
). This prevents merging not
working/incompatible code into main
.
Package uses testthat
for unit testing.
Tested functions are
encouraged - when working with networks it is sometimes easy to
introduce a bug. Assertions of what we think a function does and what
actually happens is easier when using unit tests.
Semantic versioning is used. In short:
MAJOR.MINOR.PATCH
(e.g. 0.2.1
)
MAJOR
- for incompatible
changes that possibly break existing code
MINOR
- adding new
functions to the package
PATCH
- bug fixes and minor changes
- All contributors are welcome
- We are kind