Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a workflow that tests the notebooks. #3

Merged
merged 6 commits into from
Dec 18, 2024
Merged
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
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
Loading