Giter Club home page Giter Club logo

ci-cd-workshop's Introduction

CI/CD Workshop | R in Pharma 2022

R in Pharma 2022 CI/CD workshop repository.

November 4, 2022

Exercises

Exercise 1

Fix issues identified by R CMD check workflow.

Click here for a hint ๐Ÿ”Ž A unit test is failing for hello.R.

Click here for the solution โœ… The expected message should be Welcome to the R/Pharma CI/CD workshop! (R/Pharma is missing from the message) in the tests/testthat/test-hello.R file.

Exercise 2

Fix broken links after implementing the Check URLs workflow.

Click here for a hint ๐Ÿ”Ž An R/Pharma link is broken in the NEWS.md file.

Click here for the solution โœ… The rinpharma website domain is incorrectly set as .xcom. It should be .com.

Exercise 3

Find and fix all spelling errors determined by the Spellcheck workflow.

Click here for a hint ๐Ÿ”Ž One or more words are misspelled in the NEWS.md file.

Click here for the solution โœ… The word link is misspelled as linke in NEWS.md. The word strangephrase should be strange phrase in NEWS.md. Fix the spelling first in the NEWS.md file. Next, simply run spelling::update_wordlist(confirm="Yes") to add technical jargon to the wordlist.

Exercise 4

Fix code style errors implementing the Style workflow.

Click here for a hint ๐Ÿ”Ž There's a minor style issue in the R/hello.R file.

Click here for the solution โœ… Simply run styler::style_file("R/hello.R") to automatically style the file.

Exercise 5

Reduce the cyclomatic complexity identified by the Lint Code Base workflow.

Click here for a hint ๐Ÿ”Ž The issue is manifested in the R/hello.R file.

Click here for the solution โœ… Reduce the number of if statements to reduce the cyclomatic complexity in the R/hello.R file for the linter_ex() function. Run styler::style_file("R/hello.R") to fix style issues, if any. Then, run lintr::lint_package() iteratively to determine whether the issue has been resolved.

Exercise 6

Update man pages based on the errors reported by the ROxygen workflow.

Click here for a hint ๐Ÿ”Ž Function documentation is not up-to-date for R/cicdworkshop-package.R and the linter_ex() function.

Click here for the solution โœ… Simply run roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace')) or devtools::document() to automatically update all man pages.

Exercise 7

Increase code coverage for the package.

Click here for a hint ๐Ÿ”Ž Add a simple unit test for the linter_ex() function defined in the R/hello.R file.

Click here for the solution โœ… Run covr::package_coverage() to note the current code coverage.

In the tests/testthat/test-hello.R file, add the following test:

test_that("linter_ex is surprised", {
  expect_message(
    linter_ex("lint"),
    "^Whoa!\\n"
  )
})

Run tests locally by executing devtools::test() to make sure that the tests succeed.

Then, run covr::package_coverage() to see that the code coverage has increased.

Exercise 8

Publish a website for your package using GitHub Pages.

Click here for a hint ๐Ÿ”Ž Update the _pkgdown.yml and add the pkgdown workflow.

Click here for the solution โœ… Update the url by replacing pharmaverse with your GitHub username and repository name.

ci-cd-workshop's People

Contributors

solmos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.