rtemplate
is a template for creating a basic R package with Continuous Integration (CI) via GitHub actions in the following steps:
The folder structure is as shown below:
Navigate directly to https://github.com/JGCRI/rtemplate, click the shiny green button that says Use this template
and be on your way.
You can also clone the template to view the files locally and then copy into your own repo as needed:
git clone https://github.com/JGCRI/rtemplate.git
Update your information (package name and other details) in the following files:
This is where you write the main code for your model. We have include some key modules and tests. You should write tests for all your modules as you develop them.
We provide a sample test file that should be updated as you add in new modules and classes. These tests are linked to the GitHub Action so that every time you push any changes your tests are executed. The GitHub action also links to codecov
so that you know how much of your code is covered by the tests you have written. You should aim to keep this percentage to above 70%.
Update each of the following files to generate clean, clear documentation. When you push your changes to github the github actions described in the next section will automatically build the documentation page online for you. An example for this repo is available at: https://jgcri.github.io/rtemplate/.
Once your GitHub action for docs is complete (see section 6 GitHub Actions) you need the following steps to get your documentation page live online:
The final piece is to check your GitHub actions for continuous integration. These actions have been written so they are trigger everytime you push to main or execute a pull request to main. There are four GitHub actions included with this package as follows:
The final step is to add your badges to your repository as follows. Simply replace “rtemplate” with your own repo name in the following three badges and then paste these at the top of the README.md file and push:
[![build](https://github.com/JGCRI/rtemplate/actions/workflows/build.yml/badge.svg)](https://github.com/JGCRI/rtemplate/actions/workflows/build.yml)
[![docs](https://github.com/JGCRI/rtemplate/actions/workflows/docs.yml/badge.svg)](https://github.com/JGCRI/rtemplate/actions/workflows/docs.yml)
[![tests](https://github.com/JGCRI/rtemplate/actions/workflows/test.yml/badge.svg)](https://github.com/JGCRI/rtemplate/actions/workflows/test.yml)
For the codecoverage badge use the Markdown badge you copied from codecov as shown in the final step above.