We have created a Pipeline for the R package avidaR which is launched every time we upload some changes to our GitLab remote repository (i.e., when a push command is executed from our local repository or a commit is sent from the GiLab graphical user interface). This Pipeline is defined here.
The pipeline is organized in three independent stages:
- test: avidaR is installed from GitLab, tests are run on it, and the coverage test tool is executed. No artifacts are stored.
- build: the package is built without vignettes and manual, and the R CMD check is run. The package tar-ball is stored as an artifact for later downloads.
- check: CMD check --as-cran is executed. No artifacts are stored.
We can take a look at avidaR repository --> main menu -> CI/CD -> Pipelines to monitor the Pipeline status.
If any o these stages is unsuccessfully executed, we can review it to get information about bugs or notes.
Otherwise we can continue developing and updating our source code as usual. This is useful to avoid checking our code manually every time we do an update, leaving to the end the task of checking it before submitting to CRAN.
The pipeline can be improved by publishing/sending the logs and reports to the maintainers for checking.
Note: By default, only 400 minutes of CPU execution are available for the pipelines in GitLab. When this time is reached, GitLab will suggest ... to buy more time.
The tar-ball file of the package stored at the public folder during the building stage can be downloaded to install, check, or submit it to the CRAN repository.
What are badges?
"Badges are a unified way to present condensed pieces of information about your projects. They consist of a small image and a URL that the image points to. Examples for badges can be the pipeline status, test coverage, latest release, or ways to contact the project maintainers ...".
Read here more about badges.
Pipeline status and code coverage percentage badges are populated with data extracted from the pipeline output logs created during execution.
Note: CRAN and Downloads badges are populate from the CRAN API. At the time of writing this document, avidaR package is still in development process and has not yet been sent to the CRAN repository.
In order to show the badges it in the README.md file, we have added the following code at the top of the document:
<!-- badges: start --> [![pipeline status](https://gitlab.com/fortunalab/avidaR/badges/main/pipeline.svg)](https://gitlab.com/fortunalab/avidaR/-/commits/main) [![coverage report](https://gitlab.com/fortunalab/avidaR/badges/main/coverage.svg)](https://gitlab.com/fortunalab/avidaR/-/commits/main) [![Version on CRAN](https://www.r-pkg.org/badges/version/avidaR?color=brightgreen)](https://cran.r-project.org/package=avidaR) [![Total downloads on CRAN](https://cranlogs.r-pkg.org/badges/grand-total/avidaR?color=brightgreen)](https://cran.r-project.org/package=avidaR) <!-- badges: end -->
In the repository menu -> CI/CD -> Editor, add the keyword coverage and set its value:
Then, click on the Commit Changes button.
Finally, we browse/refresh the README.md file to check out that the coverage percentage is updated.
Note: Value coverage percentage is captured from the output generated by R -e 'covr::package_coverage()' command at test stage.