mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-12-30 08:41:50 +00:00
42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
name: Test Python Scripts and Notebooks
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- '**/*.py' # Run workflow for changes in Python files
|
|
- '**/*.ipynb' # Run workflow for changes in Jupyter notebooks
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- '**/*.py'
|
|
- '**/*.ipynb'
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pytest nbval
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
|
|
- name: Test Selected Python Scripts
|
|
run: |
|
|
pytest ch04/01_main-chapter-code/tests.py
|
|
pytest ch05/01_main-chapter-code/tests.py
|
|
pytest appendix-A/02_installing-python-libraries/tests.py
|
|
|
|
- name: Validate Selected Jupyter Notebooks
|
|
run: |
|
|
pytest --nbval ch02/01_main-chapter-code/dataloader.ipynb
|
|
pytest --nbval ch03/01_main-chapter-code/multihead-attention.ipynb |