The vast majority of package developers use GitHub, however I know some (e.g. me!) prefer GitLab.
There is an existing approach, using R-Hub, to perform CI/CD with GitLab, see Setting up continuous multi-platform R package building, checking and testing with R-Hub, Docker and GitLab CI/CD for free, with a working example - Jozef's Rblog
But, GitLab offers free compute minutes, too. To that end, I've partially ported r-lib/actions to GitLab CI/CD 'Components'.
GitLab CI/CD via Components: https://gitlab.com/stephematician/r-gitlab-ci
To use in a GitLab CI/CD pipeline, we add each component via include: component
in the .gitlab-ci.yml
of our package, and then we place !reference
tags into before_script
and script
nodes of jobs, e.g.:
include:
# always include the gitlab_ci_utility component
- component: $CI_SERVER_FQDN/stephematician/r-gitlab-ci/gitlab_ci_utility@0.0.1
- component: $CI_SERVER_FQDN/stephematician/r-gitlab-ci/setup_r@0.0.1
# we can switch between powershell and bash here:
variables:
CMD: "bash"
# a job to check a package that has no dependencies:
check_package_job:
before_script:
- !reference [ .gitlab_ci_utilty-${CMD}, before_script ]
- !reference [ .setup_r-${CMD}, before_script ]
script:
- !reference [ .setup_r-${CMD}, script ]
- |
Rscript -e '
install.packages("devtools")
devtools::check()
'
Hope this is helpful to someone, and if nothing else, it was a fun exercise in learning node.js and CI/CD!