/coursera.cicd.lab

Making Data Science Work for Clinical Reporting: CI/CD Lab

Primary LanguageShellOtherNOASSERTION

coursera.cicd.lab

GitHub forks GitHub Repo stars

GitHub commit activity GitHub contributors GitHub last commit GitHub pull requests GitHub repo size GitHub language count Project Status: Active – The project has reached a stable, usable state and is being actively developed. Downloads Current Version Open Issues

Audit Dependencies BiocCheck Check URLs Coverage License report Pkgdown Docs R CMD Check R Package Validation report Release Roxygen Spelling Style SuperLinter Version bump Version check gitleaks

An R package template with built-in GitHub Actions-based CI/CD workflows.

Usage

Initialization

You could initialize this repository in one of two ways:

Clone this template

  • Clone this repository:

    git clone https://github.com/insightsengineering/coursera.cicd.lab.git
    cd coursera.cicd.lab
  • Run the initializer script:

    ./init.sh

Use GitHub's template importer

  • Click here to generate a copy of this template directly within GitHub.

  • Clone the repository from your account/organization.

  • Run the initializer script:

    ./init.sh

CI/CD Configurations

All CI/CD jobs are defined in the .github/workflows directory in the form of GitHub Action workflows. These can be modified per your requirements, but are designed and implemented to follow best practices and to ensure the highest quality standards for your package.

All workflows originating from this repository can be repurposed by other R package GitHub repositories.

👉 For more information including detailed description and screenshots of workflows, please refer to the Workflows documentation.

Pre-commit

This repository contains an example pre-commit configuration.

pre-commit is a tool that uses Git hooks to identify and resolve simple issues before submission for code review. Git hooks run on every commit to automatically point out and solve issues such as missing semicolons, trailing whitespaces, code formatting and spell checks.

Setting up pre-commit for R project

  • Install the pre-commit framework. Use the official installation guide.

  • Install R package precommit

    R -e 'install.packages("precommit")'
  • Run the use_precommit() function to generate an example pre-commit configuration called .pre-commit-config.yaml:

    [ ! -f ".pre-commit-config.yaml" ] && R -e 'precommit::use_precommit()'
  • Install the git hooks script:

    pre-commit install
  • From this moment on, all scripts from .pre-commit-config.yaml will run before every git commit command. If you want to run them manually without committing you can use command pre-commit run --all-files. For more information, please refer to the official pre-commit documentation.

NOTE: Frequently run pre-commit autoupdate to update all hooks in the .pre-commit-config.yaml configuration file.

Example output from pre-commit

$ git add .
$ git commit -m "Add pre-commit configuration"
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
style-files..............................................................Passed
roxygenize...........................................(no files to check)Skipped
use-tidy-description.....................................................Passed
spell-check..............................................................Failed
- hook id: spell-check
- exit code: 1
- files were modified by this hook

The following spelling errors were found:
  WORD          FOUND IN
commiting     README.md:77
indentify     README.md:49
informatoin   README.md:77
All spelling errors found were copied to inst/WORDLIST assuming they were not spelling errors and will be ignored in the future. Please  review the above list and for each word that is an actual typo:
 - fix it in the source code.
 - remove it again manually from inst/WORDLIST to make sure it's not
   ignored in the future.
 Then, try committing again.
Error: Spell check failed
Execution halted

lintr....................................................................Passed
readme-rmd-rendered......................................................Passed
parsable-R...............................................................Passed
no-browser-statement.....................................................Passed
deps-in-desc.............................................................Passed
prettier.................................................................Failed
- hook id: prettier
- files were modified by this hook

.pre-commit-config.yaml
README.md

Check for added large files..............................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing .pre-commit-config.yaml
Fixing README.md

Check Yaml...............................................................Passed
Don't commit to branch...................................................Passed
Mixed line ending........................................................Passed
Don't commit common R artifacts......................(no files to check)Skipped

Stargazers and Forkers

Stargazers over time

Stargazers over time

Stargazers

Stargazers repo roster for @insightsengineering/coursera.cicd.lab

Forkers

Forkers repo roster for @insightsengineering/coursera.cicd.lab