This repository houses a devcontainer that setups an R package development environment. The container is setup to work with GitHub Codespaces to instantly have a cloud-based developer workflow.
You can try out the Codespace by clicking on the following button:
Note
Codespaces are available to Students and Teachers for free up to 180 core hours per month through GitHub Education. Otherwise, you will have up to 60 core hours and 15 GB free per month.
Or, you can press the template button to create a new repository with the same setup so that you can work locally on the devcontainer:
This will create a fork of the repository that can be worked on inside a local copy of
Visual Studio Code through the Dev Containers extension. With the extension installed, you can open the repository in a container by pressing F1
(to bring up command palette) and typing Dev Container: Reopen in Container
.
Lastly, you can directly obtain the underlying container image by typing in Terminal:
docker pull ghcr.io/coatless-devcontainer/r-pkg:latest
Run the following series of commands inside of R once the container opens. Make sure to change "name-of-package"
to your current package name.
usethis::create_package("name-of-package")
usethis::use_package_doc()
usethis::use_agpl3_license()
usethis::use_testthat()
usethis::use_github_action("check-standard")
usethis::use_pkgdown_github_pages()
This repository uses a pre-built container strategy to have GitHub Actions build and, then, store the devcontainer in GitHub's Container Repository.
We place the main logic of the devcontainer in .github/.devcontainer/devcontainer.json
. From there, we use .github/workflows/pre-build-devcontainer.yml
to build and publish the devcontainer onto GitHub's Container repository for the organization. Then, the repository's .devcontainer/devcontainer.json
pulls the pre-built image.
Important
Make sure to specify the permissions as stated in the GitHub Actions workflow linked above and for organizations please make sure to have the organization's container registry enabled.
For more information, see GitHub's Container Registry documentation.