You’re welcome to contribute to {gitlabr} by editing the source code, adding more convenience functions, filing issues, etc. This document compiles some information helpful in that process.

Please also note the Code of Conduct.

Setup a development environment

The {gitlabr} test suite expects certain entities (user, project, files, comments) to be present in the test server. Below are the guidelines to setup a GitLab instance and the local file dev/environment.yml. Note that was created following these guidelines.

  1. Install & make GitLab instance reachable at a certain address. The easiest ways are to use either a Docker image of the GitLab version of interest or directly use

  2. Create a file named environment.yml and save it in the dev/ directory of your clone of {gitlabr}.

  • See environment.yml.example as the template to fill as follows
  1. Create a user on your GitLab instance
  • Add your username in environment.yml as GITLABR_TEST_LOGIN
  • Add your user ID in environment.yml as GITLABR_TEST_LOGIN_ID (numeric)
  • Add your user password in environment.yml as GITLABR_TEST_PASSWORD
  1. Generate a private access token for the user that grants all read/write access to the API

=> From now on, you can use “dev/create_testor_on_gitlab.R” script to automate required repository content for steps 5 - 11.

  1. Create a project called testor, owned by the user, and containing a file
  • New Project > Initialize with a README
  • be sure that the main branch is called main
  • Add the project name in the environment.yml as variable named “GITLABR_TEST_PROJECT_NAME”
  1. Get the ID of the project and add it in environment.yml as variable named “GITLABR_TEST_PROJECT_ID”
  • Project Overview > Details
  • The Project ID is under the name of your project
  1. Add/modify and commit the
# testor

Repository to test R package [{gitlabr}](
  1. Go to Repository > Branches and create a branch named “for-tests”.

  2. Add and commit a CI file (.gitlab-ci.yml) in the main/master branch that includes a job named testing that should minimally create public/test.txt as an artifact, we recommend using the following .gitlab-ci.yml file:

  script: echo 'test 1 2 1 2' > 'test.txt'
      - test.txt
  1. Create a commit (or use the commit just created), add a follow-up comment and add its 40-character SHA-1 hash in the environment.yml as variable named ‘COMMENTED_COMMIT’, to do so:
  • Go to Repository > Commits
  • Copy the of the relevant commit
  • Click on the relevant commit
  • Write a comment
  • Add its in ‘COMMENTED_COMMIT’ in environment.yml
  1. Create a first issue (#1) with a follow-up comment
  • Go to Issues > List > New issue
  • Add a title and a description for the issue then click on Submit issue
  • Then add a follow-up comment to this issue

How to run the test suite

When the test server is set up as described above, tests can be run with the following R code that loads the recorded environment variables and runs the test code:

devtools::load_all(), yaml::yaml.load_file("dev/environment.yml")) ## load test environment variables
devtools::test() ## run all tests
testthat::test_file("tests/testthat/test_ci.R") ## run test on one file

How to check the package with GitHub Actions on your own fork

For GitHub users, it is possible to directly use GitHub Actions to test whether the package can be build smoothly before creating a PR. To do so, they should add the following environmental variables (the ones listed in environment.yml) as encrypted secrets,


Also, another encrypted secrets named REPO_GHA_PAT is required, it should include a personal access token that has access to your GitHub repositories.

Note that the current GitHub Actions use different projects to test OS separately, in parallel. This means the following environmental variables will not work with your fork:


This value are directly set in the core of the action. If you really want to run GitHub Actions on your own fork before opening a PR, you can run “dev/create_testor_on_gitlab.R” to create the different CI repositories and modify the matrix of configuration in the corresponding CI configuration file.
However, you will need to put back original values to open a PR.

API version

The test suite is intended for use with GitLab API v4, compatibility with API v3 is no longer maintained. Still, you can switch to run the tests against API v3, by setting the environment variable GITLABR_TEST_API_VERSION to value 3. Note that API v3 is not present in recent GitLab versions!

API limitation

Note that has some limitations : Authenticated API traffic (for a given user) [From 2021-02-12]: 2,000 requests per minute