Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/notebooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
notebooks:
- path: documentation/tutorials/Demo_1_Basic_Run/run_pecan.qmd
- path: documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.qmd
- path: documentation/tutorials/Demo_03_Meta_Analysis/meta_analysis.qmd
47 changes: 39 additions & 8 deletions .github/workflows/render-quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,35 @@ jobs:
with:
version: '1.8.17'

- name: Parse notebook configuration
id: config
run: |
# Extract paths from yaml using grep and sed
# Assumes simple format: " - path: some/path.qmd"
paths=$(grep "path:" .github/notebooks.yaml | sed 's/.*path: *//')

# 1. r_files: \"/work/path1\", \"/work/path2\"
# escape quotes for R vector
r_files_raw=$(echo "$paths" | awk '{printf "\\\"/work/%s\\\", ", $0}')
r_files=${r_files_raw%, }

# 2. render_cmd: quarto render /work/path1 --to html && ...
render_cmd_raw=$(echo "$paths" | awk '{printf "quarto render /work/%s --to html && ", $0}')
render_cmd=${render_cmd_raw% && }

# 3. paths (space separated) for artifact loop
paths_out=$(echo "$paths" | tr '\n' ' ')

echo "r_files=$r_files" >> $GITHUB_OUTPUT
echo "render_cmd=$render_cmd" >> $GITHUB_OUTPUT
echo "paths=$paths_out" >> $GITHUB_OUTPUT

- name: Check R code style with styler
run: |
docker run --rm -v ${{ github.workspace }}:/work pecan-base-ci:latest bash -c "Rscript -e '
if (!requireNamespace(\"styler\", quietly = TRUE)) install.packages(\"styler\");
files_to_check <- c(
\"/work/documentation/tutorials/Demo_1_Basic_Run/run_pecan.qmd\",
\"/work/documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.qmd\"
${{ steps.config.outputs.r_files }}
);
unstyled <- styler::style_file(files_to_check);
if (is.data.frame(unstyled) && \"changed\" %in% names(unstyled) && any(unstyled\$changed == TRUE)) {
Expand All @@ -48,17 +70,26 @@ jobs:
- name: Render Quarto notebooks to HTML
run: |
docker run --rm -v ${{ github.workspace }}:/work pecan-base-ci:latest bash -c "
quarto render /work/documentation/tutorials/Demo_1_Basic_Run/run_pecan.qmd --to html &&
quarto render /work/documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.qmd --to html
${{ steps.config.outputs.render_cmd }}
"

- name: Prepare HTML artifacts
run: |
mkdir quarto_html_build
cp documentation/tutorials/Demo_1_Basic_Run/run_pecan.html quarto_html_build/
cp -r documentation/tutorials/Demo_1_Basic_Run/run_pecan_files quarto_html_build/
cp documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.html quarto_html_build/
cp -r documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty_files quarto_html_build/
for p in ${{ steps.config.outputs.paths }}; do
html_file="${p%.qmd}.html"
files_dir="${p%.qmd}_files"

if [ -f "$html_file" ]; then
cp "$html_file" quarto_html_build/
else
echo "Warning: $html_file not found"
fi

if [ -d "$files_dir" ]; then
cp -r "$files_dir" quarto_html_build/
fi
done

- name: Upload rendered HTML as artifacts
uses: actions/upload-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The following Tutorials assume you have installed PEcAn. If you have not, please
|:--:|:---:|:------:|:-------------:|
|Demo| Basic Run (Quarto)| <a href="rendered-demo-notebooks/run_pecan.html" target = "_blank">html</a> | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/Demo_1_Basic_Run/run_pecan.qmd" target = "_blank">qmd</a> |
|Demo| Uncertainty Analysis (Quarto)| <a href="rendered-demo-notebooks/uncertainty.html" target = "_blank">html</a> | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/Demo_02_Uncertainty_Analysis/uncertainty.qmd" target = "_blank">qmd</a> |
|Demo| Meta Analysis (Quarto)| <a href="rendered-demo-notebooks/meta_analysis.html" target = "_blank">html</a> | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/Demo_03_Meta_Analysis/meta_analysis.qmd" target = "_blank">qmd</a> |
|Demo| Basic Run| [html](#demo-1) | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/01_Demo_Basic_Run/Demo01.Rmd" target = "_blank">Rmd</a> |
|Demo| Uncertainty Analysis| [html](#demo-2)| <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/02_Demo_Uncertainty_Analysis/Demo02.Rmd" target = "_blank">Rmd</a> |
|Demo| Output Analysis|html | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/AnalyzeOutput/modelVSdata.Rmd" target="_blank">Rmd</a> |
Expand Down
13 changes: 7 additions & 6 deletions documentation/tutorials/Demo_03_Meta_Analysis/meta_analysis.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
title: "Demo 03: Meta Analysis"
author: "Aritra Dey"
format:
pdf:
toc: true
number-sections: true
fig-width: 10
fig-height: 6
fig-dpi: 300
html: default
pdf: default
toc: true
number-sections: true
fig-width: 10
fig-height: 6
fig-dpi: 300
---

# Introduction {#introduction}
Expand Down
Loading