Skip to content

Commit

Permalink
Merge pull request #63 from microbiomedata/notebook_check_ghaction
Browse files Browse the repository at this point in the history
Add github workflow for checking notebooks
  • Loading branch information
brynnz22 authored Jul 17, 2024
2 parents e1faccb + 9256652 commit a6494b2
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 239 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ _or_
4. Create a .Rmd and convert it to a Jupyter Notebook. Several methods for this exist and none are perfect, but [this open source method](https://github.com/mkearney/rmd2jupyter) currently works.
5. Run the entire notebook to ensure it is working as expected and save the *rendered* notebook in the folder.
6. Update the `README.md` in the folder to include links to the rendered notebook (using [nbviewer](https://nbviewer.org/) and [google colab](https://colab.research.google.com/)).
7. Add the notebooks to the appropriate github workflow to ensure they are included in the continuous integration process. See the `.github/workflows` folder for existing workflows (one for the R notebooks and one for the python notebooks). Add the new notebook to the end of the list of notebooks in the workflow file.


## Dependency Management
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/notebook_check_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Execute python notebooks

on:
pull_request:
workflow_dispatch:
# run once a week
schedule:
- cron: "0 0 * * 0"

jobs:
build:
runs-on: ubuntu-latest

steps:
- id: checkout
uses: actions/checkout@v3

- id: python-setup
name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'

- id: python-dependencies
name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
pip install jupyter
- id: execute-bioscales
name: Execute bioscales notebook
run: |
jupyter nbconvert --execute --to notebook --inplace bioscales_biogeochemical_metadata/python/bioscales.ipynb
- id: execute-neon
name: Execute neon notebook
run: |
jupyter nbconvert --execute --to notebook --inplace NEON_soil_metadata/python/neon_soil_metadata_visual_exploration.ipynb
- id: execute-taxonomic
name: Execute taxonomic notebook
run: |
jupyter nbconvert --execute --to notebook --inplace taxonomic_dist_by_soil_layer/python/taxonomic_dist_soil_layer.ipynb
55 changes: 55 additions & 0 deletions .github/workflows/notebook_check_r.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Execute R notebooks

on:
pull_request:
workflow_dispatch:
# run once a week
schedule:
- cron: "0 0 * * 0"

jobs:
build:
runs-on: ubuntu-latest

steps:
- id: checkout
uses: actions/checkout@v3

- id: python-setup
name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'

- id: install-juptyer
name: Install Juptyer
run: |
python -m pip install --upgrade pip
pip install jupyter
- id: r-setup
name: Set up R
uses: r-lib/actions/setup-r@v2

- id: r-dependencies
name: Install r dependencies
run: |
R -e 'install.packages("renv")'
R -e 'renv::restore()'
R -e 'install.packages("IRkernel")'
R -e 'IRkernel::installspec()'
- id: execute-bioscales
name: Execute bioscales notebook
run: |
jupyter nbconvert --execute --to notebook --inplace bioscales_biogeochemical_metadata/R/bioscales_metadata.ipynb
- id: execute-neon
name: Execute NEON metadata notebook
run: |
jupyter nbconvert --execute --to notebook --inplace NEON_soil_metadata/R/NEON_data_exploration.ipynb
- id: execute-taxonomic
name: Execute taxonomic metadata notebook
run: |
jupyter nbconvert --execute --to notebook --inplace taxonomic_dist_by_soil_layer/R/taxonomic_dist_soil_layer_R.ipynb
Loading

0 comments on commit a6494b2

Please sign in to comment.