Skip to content

Add pytest script and CI job to test tutorials #4

Add pytest script and CI job to test tutorials

Add pytest script and CI job to test tutorials #4

Workflow file for this run

name: Examples
on:
push:
branches:
- main
- release**
- "**maintenance"
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
schedule:
- cron: '0 6 * * 1'
jobs:
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv pip install --system .[examples]
- name: Checkout mesa-examples
uses: actions/checkout@v4
with:
repository: projectmesa/mesa-examples
path: mesa-examples
- name: Test examples
run: |
cd mesa-examples
pytest -rA -Werror -Wdefault::FutureWarning test_examples.py
tutorials:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: uv pip install --system . pytest nbval jupyter nbconvert
# Run Pytest on Jupyter Notebooks
- name: Test Jupyter Notebooks with Pytest
run: pytest -rA -Werror -Wdefault::FutureWarning tests/test_tutorials.py