Skip to content

Execute notebooks

Execute notebooks #10

name: Execute notebooks
on:
# Run on demand
workflow_dispatch:
# 6.49 am (GMT) every Monday; time chosen at random
schedule:
- cron: "49 6 * * MON"
# Limit workflow permissions
permissions:
contents: read
# Limit simultaneous workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FORCE_COLOR: "1"
jobs:
execute:
name: Update notebooks
if: github.repository_owner == 'Econ-ARK'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10" # Numba doesn't support Python 3.11 [2023-05]
cache: 'pip'
cache-dependency-path: |
requirements/base.txt
.github/workflows/execute-notebooks.yml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
# For LabeledModels.ipynb
python -m pip install estimagic
# For nbstripout
python -m pip install nbstripout
# For nb_exec.py
python -m pip install ipykernel nbclient nbformat
- name: Strip output
run: nbstripout examples/**/*.ipynb
# This step takes c. 20 minutes
- name: Execute notebooks
run: python tools/nb_exec.py examples/**/*.ipynb
env:
PYTHONUNBUFFERED: "1"
- name: Open PR
uses: peter-evans/create-pull-request@v5
with:
author: "Econ-ARK Bot <noreply@econ-ark.org>"
branch: "bot/update-notebooks"
commit-message: "[bot] updated notebooks"
delete-branch: true
title: "[bot] Execute example notebooks"
# language=Markdown
body: >
This PR was [automatically generated] to re-execute
the example notebooks for use in the documentation.
[automatically generated]: https://github.com/Econ-ARK/HARK/actions/workflows/execute-notebooks.yml