Skip to content

Add Continuous Integration#1

Open
rjc206 wants to merge 5 commits into
ImmuSystems-Lab:mainfrom
rjc206:main
Open

Add Continuous Integration#1
rjc206 wants to merge 5 commits into
ImmuSystems-Lab:mainfrom
rjc206:main

Conversation

@rjc206
Copy link
Copy Markdown

@rjc206 rjc206 commented May 19, 2026

Add pull request.

@omsai omsai self-requested a review May 20, 2026 19:01
Copy link
Copy Markdown
Collaborator

@omsai omsai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Apply the commits from the review as you see fit and then test that the changes you apply still build the vignette on your repository and reply with a link to the successful CI and output website.

  • If it does not work as expected you may then need to troubleshoot it in your local Docker container or add some debugging bash shell lines of code into your CI file to find what went wrong.

@@ -0,0 +1,27 @@
name: Render and Deploy to GitHub Pages
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Render and Deploy to GitHub Pages
---
name: Render and Deploy to GitHub Pages

YAML files start with three dashes. I use the yamllint tool recommended by the YAML standard: https://yaml.org/tools/ which highlights the need to fix this issue, although another handy reference I like is from Learn X in Y Minutes: https://learnxinyminutes.com/yaml/

render:
runs-on: ubuntu-latest
container:
image: rocker/verse:4.4.1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image: rocker/verse:4.4.1
image: rocker/verse:latest

Use the latest tag as listed here: https://hub.docker.com/r/rocker/verse/tags ... it's quite likely that using this 2 year old version of R is what's causing the problems you saw with ggplot.

container:
image: rocker/verse:4.4.1
steps:
- uses: actions/checkout@v4
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

Name all steps; naming here acts somewhat like comments do in code where you are explaining your rationale for what you're doing, as well as in your GitHub workflow graph / list.


- name: Install RStan
run: |
R -q -e 'install.packages(c("rstan", "rstantools", "bayesplot", "deSolve", "posterior"), repos = "https://cloud.r-project.org")'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
R -q -e 'install.packages(c("rstan", "rstantools", "bayesplot", "deSolve", "posterior"), repos = "https://cloud.r-project.org")'
Rscript -e 'pak::local_install_deps("stanodeffr", dependencies = TRUE)'
  1. The whole point of having a package is for you not have to explicitly specify the dependencies like you are doing here; the DESCRIPTION file does that for you. The DESCRIPTION contains Imports dependencies which are required for the package functions to run and Suggests dependencies which are required to build the vignettes. Here we are building a single vignette and the package has no functions, so the dependencies are all in the Suggests section. Unlike Imports, dependencies in the Suggests section are optional and not installed by default, because the assumption is that you may want to install a package without all the extra dependencies if you're not doing to build the vignettes. Therefore to build the vignette we have to explicitly ask for the optional Suggests dependencies to be installed using dependencies = TRUE. How would you know to use TRUE? Read the documentation for ?pak::local_install_deps.

  2. Don't use R in CI; R is meant for interactive work whereas Rscript is meant for non-interactive / batch work. See https://cloud.r-project.org/doc/manuals/r-release/R-intro.html#Scripting-with-R-1

  3. Do not override your value of repos; the default value points to a binary package repository which significantly cuts down on package installation time by skipping the compilation:

    > getOption("repos")
                                             CRAN 
    "https://p3m.dev/cran/__linux__/noble/latest"


- name: Render Rmd
run: |
R -q -e 'rmarkdown::render("stanodeffr/01-stan-ode-forcing-function.Rmd", output_format = "html_document", output_file = "index.html", output_dir = "docs")'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
R -q -e 'rmarkdown::render("stanodeffr/01-stan-ode-forcing-function.Rmd", output_format = "html_document", output_file = "index.html", output_dir = "docs")'
Rscript -e 'rmarkdown::render("stanodeffr/01-stan-ode-forcing-function.Rmd", output_format = "all", output_dir = "public")'
  1. For the conference, we are testing not only HTML vignettes, but also PDF vignettes in case the AI assistant views them differently. So render all the formats as described in the README.md

  2. The next default value for the step is public/ directory according to https://github.com/peaceiris/actions-gh-pages/blob/v4.1.0/action.yml#L27

  3. As above, use Rscript instead of R for non-interactive code.

R -q -e 'rmarkdown::render("stanodeffr/01-stan-ode-forcing-function.Rmd", output_format = "html_document", output_file = "index.html", output_dir = "docs")'

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4.1.0

Don't use an arbitrary old version, use the latest tagged version that is most up-to-date, has security fixes, etc. See https://github.com/peaceiris/actions-gh-pages/releases

uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
publish_dir: ./docs

You no longer need to specify an input directory if you're creating the default public/ it wants above using rmarkdown::render(..., output_dir = "public")

Comment thread Dockerfile
Comment on lines +1 to +3
FROM rocker/verse:4.4.1
RUN apt-get update && apt-get install -y --no-install-recommends libv8-dev && rm -rf /var/lib/apt/lists/*
RUN R -q -e 'install.packages(c("rstan", "rstantools", "bayesplot"), repos = "https://cloud.r-project.org")'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't be part of the PR at all. You woudn't use a Dockerfile to reproduce what the CI is doing; it would be a set of bash shell commands.

Comment on lines +659 to +661
inherit.aes = FALSE,
aes(x = time, y = value),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to edit this file if you're using an up-to-date rocker/rverse image instead of the 2 year old 4.4 version.

- name: Render Rmd
run: |
R -q -e 'rmarkdown::render("stanodeffr/01-stan-ode-forcing-function.Rmd", output_format = "html_document", output_file = "index.html", output_dir = "docs")'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Create index.html pages to see all vignette files
run: |
cd public/
apt update
apt -y install tree
tree -H '.' \
-T 'Vignettes for Stan ODE forcing function'
-I index.html \
--noreport \
--houtro "" \
-o index.html

This creates an HTML file with links to all the vignette files in the directory; see https://stackoverflow.com/a/46383157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants