Make it easy to use Azure DevOps Pipelines to check, test, and lint R packages by providing a 'drop in' yaml file and simple instructions.
Pull requests are set up to trigger a pipeline run. The pipeline lints the code using MegaLinter and lintr, and checks the package using rcmdcheck::rcmdcheck(). Unit tests are run with testthat during rcmdcheck
. Code coverage is evaluated by covr::azure()
Linting, checking, testing, and code coverage results are available for review on the Azure pipeline.
The files azure-pipelines.yml
and /tests/testthat
are the core of this repository. The actual package contains only one toy function hello()
.
- Ensure Azure build minutes are activated
- Add
azure-pipelines.yml
file to root of your repository on Azure DevOps. - Add
/tests/testthat
to your project substituting occurrences of the textAzurePipelineR
with your package name. This outputs test results in JUnit format to the filetest-results.xml
when run on linux in non-interactive mode. - Set up new pipeline
- Pipelines > Pipelines > New Pipeline > Azure Repos Git > mypackage > Existing Azure Pipelines YAML file > Path > azure-pipelines.yml
- Run pipeline
- Set up branch policies to run pipeline for pull requests using these instructions
This pipeline was pieced together from numerous sources that are gratefully acknowledged.
- https://stackoverflow.com/questions/60045425/how-to-make-azure-pipeline-yml-for-ci-for-a-r-package
- https://community.rstudio.com/t/creating-an-azure-pipelines-yml-for-azure-devops-testing-packages-shiny-scripts/32471/2
- https://adinermie.com/publishing-github-super-linter-terraform-quality-checks-to-azure-devops-pipelines/
- https://github.com/r-lib/r-azure-pipelines
- https://github.com/r-lib/r-azure-pipelines/blob/master/tests/testthat.R
- oxsecurity/megalinter#538 (comment)