Where do you want to set-up checklist
?
- I want to create a new R package from scratch.
- I want to use or update
checklist
in an existing R package.
Go to
vignette("getting_started_project", package = "checklist")
when you want to use checklist
on a project.
Starting an R package from scratch
Prepare online setup
- Go to https://github.com and login.
Create a new public repository in the INBO organisation. Use the package
name as repository name. Enter the repository name and optionally a
description. Don’t add a
README
,.gitignore
orLICENSE
.
Local setup
- Install or update the checklist package with
remotes::install_github("inbo/checklist")
. - Use
checklist::create_package()
. You’ll need to provide the package name, title, description and maintainer. Please read the documentation ofcreate_package()
prior to running the function. The function creates an RStudio project with a the package template in a folder with the name of the package. - Open the newly created RStudio project.
- In the Build pane, select More > Configure Build Tools. Click the Configure button and add a tick to Install and Restart. All boxes except Vignettes must be ticked. Close the two dialogue boxes by clicking the OK buttons (once for each of box).
- Open the
README.Rmd
file and update the content. Knit the file and stage theREADME.Rmd
andREADME.md
files. - Review and commit the changes into an initial commit.
- Add at least one function to the package.
- Build the package.
- Run
x <- checklist::check_package()
. Fix any issues that arise during the checks. Repeat the last two steps until you end up with only a single new note about a New submission. - Run
checklist::write_checklist(x)
. This functions can convert some ‘new’ warnings and notes into ‘allowed’ warnings and notes. - Run
x <- checklist::check_package()
again to check that only ‘allowed’ warnings and notes remain. Repeat the last four steps until you get No problems found at the end of the checklist output. - Commit any remaining changes.
- Run in the git terminal the command
git remote add origin git@github.com:inbo/_your_package_name_.git
where you replace_your_package_name_
with the actual repository name. - Run in the terminal the command
git push -u origin main
. This will run the checklist test on GitHub for the first time. An orange circle, green thick mark or red cross will appear next to the latest commit or PR.
Finalise online setup
- Go to https://about.codecov.io and login with your GitHub account. Search for your package repository in the INBO organisation. Copy the token.
- Go to your package repository on GitHub. Choose Settings
> Secrets. Add New repository secret with
name
CODECOV_TOKEN
and the token you copied as value. - Wait for all tests to finish (either green thick or red cross).
- Go in your package GitHub repository to Settings >
Branches. Add rule for Branch name pattern
main
and select the following items and Save changes.Require status checks to pass before merging
Require branches to be up to date before merging
-
Status checks found in the last week for this repository
check package
macOS-latest (release)
ubuntu (oldrel)
ubuntu (devel)
windows (release)
- Go in your package GitHub repository to Settings >
Pages. Select Deploy for branch as source,
gh-pages
as branch and save the changes.
Get it working with an existing package or update the checklist
Prerequisites
- Make sure the package is using git as version control system.
- The git status must be clean. You’ll need to commit all changes first. It is OK to have Untracked files.
- You need a public remote git repository at https://github.com/inbo.
Local setup
- Install the checklist package with
remotes::install_github("inbo/checklist")
. - Run
checklist::setup_package()
. This will add and/or modify files. Inspect the modified files, especially if you are updating to a new checklist version and made some tweaks in the past. - Commit the changes.
- Run
x <- checklist::check_package()
and fix any issues. Repeat this step until you have only issues that are not a problem. Commit any remaining changes. - Update the
checklist.yml
withchecklist::write_checklist(x)
. This function will ask you which (if any) of the current allowed warnings and notes you want to keep. Then it asks which warnings and notes you want to allow. You’ll need to motivate each of them. - Run
x <- checklist::check_package()
. This should run without returning an error.
Online setup
- Go to https://about.codecov.io and login with your GitHub account. Search for your package repository in the INBO organisation. Copy the token.
- Go to your package repository on GitHub. Choose Settings
> Secrets. Create a new repository secret with name
CODECOV_TOKEN
and the token you copied as value. - Push changes from your local repository to GitHub. This will start the checks on GitHub. An orange circle, green thick mark or red cross will appear next to the latest commit or PR. Wait for all tests to finish (either green thick or red cross).
- Go in your package GitHub repository to Settings >
Branches. Add rule for Branch name pattern
main
and select the following items and Save changes.Require status checks to pass before merging
Require branches to be up to date before merging
-
Status checks found in the last week for this repository
check package
macOS (release)
ubuntu (oldrel)
ubuntu (devel)
windows (release)
- Go in your package GitHub repository to Settings >
Pages. Select Deploy for branch as source,
gh-pages
as branch and save the changes.
Troubleshooting
Failing status check check package
Sometimes the check package GitHub Action (GHA
) may fail
for other reasons than failure of one or more of the checks executed by
checklist::check_package()
. This is likely due to a missing
dependency when the action tries to install R packages. In that case,
the GHAs
, check_on_branch.yml
and
check_on_main.yml
files need to be modified so the missing
dependency can be installed. To diagnose if this is the case when an
action failed, you can follow these steps:
- Go to the check package
GHA
with a red cross (indicating failure) and click on thedetails
link. You will be directed to an overview of all steps that were taken in the action. The page will scroll automatically to where the final error occurs. - Check if you see an error that looks like:
ERROR: dependency 'sf' is not available for package 'inborutils'
ERROR: package installation failed
- If this is the case, make a mental note of which package(s) failed to install.
- Next, open the raw logs by clicking on the gear icon and then
View raw logs
. - Search the log (CTRL+F) using the name of the package or more
specifically search for
installing *source* package '<packagename>'
. Also try searching forerror:
,failed
anddeb:
.- It is likely that you detect that it is actually a dependency R
package that failed to install and that this failing installation was
due to a missing system dependency.
- For instance, in the example above, the culprit was that the R
package
units
- which is a dependency ofsf
- failed to install, because it depended on the system dependencylibudunits2-dev
- The easiest way to detect this, is to search for
deb:
. Here is a snippet of what you might see:
Configuration failed because libudunits2.so was not found. Try installing: * deb: libudunits2-dev (Debian, Ubuntu, ...) * rpm: udunits2-devel (Fedora, EPEL, ...) * brew: udunits (OSX)
- For instance, in the example above, the culprit was that the R
package
- It is likely that you detect that it is actually a dependency R
package that failed to install and that this failing installation was
due to a missing system dependency.
To fix this problem in the check_on_branch.yml
and
check_on_main.yml
files, install it with the
aptget
command:
```
steps:
- uses: inbo/actions/check_pkg@master
with:
aptget: libudunits2-dev
```
In case you need multiple aptget
dependencies, add them
to a single aptget
item separated with a space.
```
steps:
- uses: inbo/actions/check_pkg@master
with:
aptget: libudunits2-dev libpoppler-cpp-dev
```
Add, commit and push these changes so they take effect in the
GHAs
.