-
-
Notifications
You must be signed in to change notification settings - Fork 85
CI Guide
The following guide describes the CI setup that is used in mlr3
and all of its extension packages.
We use tic to simplify CI tasks.
To get a basic overview of tic, read its vignettes.
Especially the one listing its advantages compared to using Travis without tic support.
Note: To do this, you need to have administration rights for the "mlr-org" organization.
- Run
travis::use_tic()
. During the process, browser pages will open up, ensuring that all permissions are set correctly and all apps are authorized. Also a Personal Access Token (PAT) will be created on GitHub and stored as an encrypted variable on Travis. This avoids hitting rate limitations when accessing the GitHub API. The access token does not need any additional rights. - Copy the
.travis.yml
file from mlr3 and paste its content into the respective file in your package that was just created in the previous step. - Do the same for the
tic.R
file.
Now you should have a working setup the does the following:
- Installs all required dependencies based on your
DESCRIPTION
- Runs
R CMD check
on the package (scripts fails if errors are found) - Builds a pkgdown site of the package which is served from the
docs/
directory of the master branch - Runs
covr::codecov()
to calculate the code coverage of the package
Doc files (man/
, NAMESPACE
and DESCRIPTIPON
) are created and auto-deployed during the CI run.
Now that the pkgdown site if the package was built by Travis, you need to enable it. We have our own domain for the mlr-org (https://mlr-org.com) and use subdomains for all our packages to host their pkgdown sites.
- Go to "Settings" in the repository and under "Github Pages" set "Source" to "master branch docs/ folder".
- Click "Save"
- Scroll down again to "Github pages". Now there is a field "Custom domain". Enter the following:
<pkg name>.mlr-org.com
. - Our DNS server is managed via Netlify. Ping one of the admins (@larskotthof, @berndbischl, @mllg, @jakob-r, @pat-s) and ask them to add your subdomain to the DNS configuration (when logged in, the DNS configuration can be found under "Settings - Domain Management". Then click on the three dots of "mlr-org.com" and select "Go to DNS Panel").
- Add the subdomain url to the "website" field in the main repo window (at the top of the repo, below the menu bar listing "code", "issues" etc.).
- Don't worry if the site is not instantly accessible over https. It takes some time until the DNS server has picked up the change. However, the site should already be available via http.
- Add
^docs$
and^pkgdown$
to.Rbuildignore
. - Copy
man/figures/logo_navbar.png
to your repo.
Almost done. To have a consistent pkgdown theme across all packages, please also copy the pkgdown
folder to your repo. Update the pkgdown/_pkgdown.yml
file so that it matches your repo.
- Change URL field
- Update "navbar" entries
ToDO: Provide a package that can be used as the default "template". Advantage: Changes there will be ported to all subsequent packages using the template. See https://github.com/tidyverse/tidytemplate.
Whenever a Pull Request changes content in a vignette, the changes can be preview in a fully-rendered pkgdown site. To enable this, follow these steps:
- Go Netlify and click "Create new site from git"
- Choose the repo and accept all defaults.
- Go to "General - Site Details" and change the site name to
<pkgname>-preview
. - Go to "Build & Deploy - Continuous Deployment" and set "Build command = true" and "Publish directory = docs".
- Go to "Build & Deploy - Deploy Notifications" and remove all outgoing notifications. Add the following ones by clicking on "Add notification - Github commit status": "Add deploy notifications to git commits when deploy starts/succeeded/failed".
- Go to "Build & Deploy - Deploy contexts" and change to "Branch deploys - All".
CI
Roxygen (Documentation)
Style
Misc