Skip to content

Commit

Permalink
Add a workflow that tests the notebooks. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
vengroff authored Dec 18, 2024
1 parent 1a9fc6a commit c3dac43
Show file tree
Hide file tree
Showing 4 changed files with 280 additions and 62 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/nbmake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Test run all the notebooks whenever we push a branch.

name: nbmake

on:
push:
branches-ignore:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
# List the notebooks
list-notebooks:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.notebook-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: notebook-matrix
run: echo "matrix=$(find notebooks -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
nbmake:
needs: list-notebooks
runs-on: ubuntu-latest
strategy:
matrix:
notebook: ${{ fromJson(needs.list-notebooks.outputs.matrix) }}
fail-fast: false
steps:

- uses: actions/checkout@v4

- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install poetry
uses: abatilo/actions-poetry@v2

- name: Use poetry to install dependencies.
run: poetry install --with test

- name: Install API key
env: # Or as an environment variable
RA_API_KEY: ${{ secrets.RA_API_KEY }}
run: |
mkdir ~/.rwapi
echo "$RA_API_KEY" > ~/.rwapi/api_key.txt
- name: Test the notebook
run: |
poetry run pytest --nbmake "${{matrix.notebook}}"
57 changes: 27 additions & 30 deletions notebooks/Health Impacts.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit c3dac43

Please sign in to comment.