Skip to content

Commit

Permalink
#216 cicd updates
Browse files Browse the repository at this point in the history
  • Loading branch information
manciniedoardo committed Sep 5, 2024
1 parent ac6337d commit 03ccacc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
15 changes: 14 additions & 1 deletion inst/WORDLIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ Encyclopædia
FDA's
FORMN
Farrugia
Franciszek
GBR
GSK
Genentech
Genentech's
Github
Golem
Gottfried
Grasselly
Gregor
GxP
GyuTYh
Expand Down Expand Up @@ -317,6 +319,7 @@ Rodziewicz
Roundings
Rprofile
Rproj
Rscript
Rubalingam
Rucki
SDS
Expand All @@ -334,6 +337,7 @@ SUBJIDN
SUBJTYP
SUBJTYPC
Sadchla
Salzburg
Sanofi
Sanofi's
Shen
Expand Down Expand Up @@ -369,9 +373,11 @@ TTAE
Tatiana
TatianaPXL
Taşlıçukur
TcADhWosA
TestDataFactory
Thoma
TidyCDISC
TLDR
Tplyr
Travese
Tymoteusz
Expand Down Expand Up @@ -401,6 +407,7 @@ Viyash
WAWA
WG
WTBL
Walkowiak
WebAssembly
WebR
WnpvVgmyE
Expand Down Expand Up @@ -494,6 +501,8 @@ changelog
cheatsheet
checkin
ci
cicd
cli
codebase
codelist
colcounts
Expand Down Expand Up @@ -655,6 +664,7 @@ knoph
kumari
labsbl
lang
lapply
learnings
leena
lexjansen
Expand Down Expand Up @@ -730,6 +740,7 @@ pharmacovigilance
pharmar
pharmaverse
pharmaverseadam
pharmaverseblog
pharmaversesdtm
phriends
phuse
Expand Down Expand Up @@ -776,6 +787,7 @@ riskassessment
riskmetric
riskscore
rlistings
rmarkdown
rnorm
roche
ropensci
Expand Down Expand Up @@ -876,6 +888,7 @@ trtemfl
trunc
ttae
tte
ubuntu
ucla
ug
ui
Expand Down Expand Up @@ -1072,4 +1085,4 @@ accountabilities
curation
requestor
pageId
viewpage
viewpage
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: "We are very excited to announce that new extension packages are ex
date: "2024-06-17"
# please do not use any non-default categories.
# You can find the default categories in the repository README.md
categories: [Metadata, ADaMs, Community]
categories: [Metadata, ADaM, Community]
# feel free to change the image
image: "coming_soon.png"
---
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The script works as follows:

The final error message looks something like the below:

```{r, eval = FALSE}
```
✖ The tag(s) "ADaMs" in the post
"2024-06-17_new_admiral_ex.../new_admiral_extension_packages_admiralpeds_coming_soon.qmd"
are not from the allowed list of tags.
Expand All @@ -125,7 +125,7 @@ Please select from the following tags: "Metadata", "SDTM", "ADaM", "TLG", "Shiny

## Creating a pipeline for the check

When it came to creating a pipeline for the check, if you had asked me to do this a few months ago, I wouldn't have known my left from my right. Luckily I had recently attended a great CICD workshop at useR 2024 in Salzburg, led by Daphne Grassely, Francisek Wolowiak and Pawel Rucki. You can find the repository from their workshop https://github.com/user-workshop-cicd/r.package.example - it was invaluable to orient me in the right direction. Through a (very naive) google search, I also found [this video](https://www.youtube.com/watch?v=u-TcADhWosA), which shows how to execute an R script automatically whenever a pull request is made to the `main` branch of a repo.
When it came to creating a pipeline for the check, if you had asked me to do this a few months ago, I wouldn't have known my left from my right. Luckily I had recently attended a great CICD workshop at useR 2024 in Salzburg, led by Daphne Grasselly, Franciszek Walkowiak and Pawel Rucki. You can find the repository from their workshop https://github.com/user-workshop-cicd/r.package.example - it was invaluable to orient me in the right direction. Through a (very naive) google search, I also found [this video](https://www.youtube.com/watch?v=u-TcADhWosA), which shows how to execute an R script automatically whenever a pull request is made to the `main` branch of a repo.

Through some trial and error, I was able to coalesce the above resources into quite a short `yaml` file that set up my CICD pipeline. Within the pharmaverseblog repository, the CICD pipelines live under `.github/workflows`. There, I added the following new workflow, in the form of a `yaml` file, called `check_post_tags.yml`:

Expand Down Expand Up @@ -153,15 +153,26 @@ It's deceptively simple to read:

1. We execute the workflow upon any pull request to main
2. When there is a pull request to main, we can use the `rocker/tidyverse:4.2.1` to install all the `{tidyverse}` packages.
3. Then we need to checkout the phamraverseblog repo and run the `check_post_tags.R` script.
3. Then we need to checkout the pharmaverseblog repo and run the `check_post_tags.R` script.

That's it! If there are any problematic posts, the script will throw an error and the check will fail like so:

![](failed_check.png){fig-align="center" width="500"}

Clicking on the "Details" option will return the error message I constructed previously.

![](failed_check_details.png){fig-align="center" width="500"}

Otherwise, no error will be thrown, the check will pass, and the post is good to go (provided the other checks pass)!

That's it! If there are any problematic posts, the script will throw an error and the check will fail and return the error message I constructed. Otherwise, no error will be thrown and the check will pass.

# Conclusion

The hardest aspect of the whole process was surpassing the mental barrier of getting started. CICD can be an overwhelming and mysterious topic, but it's only as complicated as you make it. Of course, I'm still an absolute novice, and maybe my implementation above is not perfect, but I was still able to write code that solved my problem.
![](cicd_meme.png){fig-align="center" width="400"}

The hardest aspect of the whole process was surpassing the mental barrier of getting started. CICD can be an overwhelming and mysterious topic, but it's only as complicated as you make it. Of course, I'm still an absolute novice, and maybe my implementation above is not perfect, and there are definitely more complex applications of CICD, but I was still able to write code that solved my specific problem.

If you'd like to read more about CICD wihtin the pharmaverseblog, I'd highly recommend this [detailed post](https://stefanthoma.github.io/quarto-blog/posts/2023-01-09_CICD-spelling/) by Stefan Thoma on his own blog, where he discusses implementations on the spelling check.
If you'd like to read more about CICD within the pharmaverseblog, I'd highly recommend this [detailed post](https://stefanthoma.github.io/quarto-blog/posts/2023-01-09_CICD-spelling/) by Stefan Thoma on his own blog, where he discusses implementations on the spelling check.

Do you have any use cases for CICD within the pharmaverseblog or any of your own projects? Please reach out - I'd love to hear from you!

Expand Down

0 comments on commit 03ccacc

Please sign in to comment.