Set up basic test gh worklows (#79)

* Set up basic test gh worklows

* update file paths

* env check

* add env check

* Update requirements.txt

* simplify

* upd
This commit is contained in:
Sebastian Raschka
2024-03-18 11:58:37 -05:00
committed by GitHub
parent 9d6da22ebb
commit ca96abac8a
13 changed files with 50241 additions and 110 deletions

41
.github/workflows/basic-tests.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
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 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