basic-tests-macos-uv.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: Code tests macOS
  2. on:
  3. push:
  4. branches: [ main ]
  5. paths:
  6. - '**/*.py'
  7. - '**/*.ipynb'
  8. - '**/*.yaml'
  9. - '**/*.yml'
  10. - '**/*.sh'
  11. pull_request:
  12. branches: [ main ]
  13. paths:
  14. - '**/*.py'
  15. - '**/*.ipynb'
  16. - '**/*.yaml'
  17. - '**/*.yml'
  18. - '**/*.sh'
  19. workflow_dispatch:
  20. concurrency:
  21. group: ${{ github.workflow }}-${{ github.ref }}
  22. cancel-in-progress: true
  23. jobs:
  24. uv-tests:
  25. name: Code tests (macOS)
  26. runs-on: macos-latest
  27. steps:
  28. - uses: actions/checkout@v4
  29. - name: Set up Python (uv)
  30. uses: actions/setup-python@v5
  31. with:
  32. python-version: "3.13"
  33. - name: Install uv and dependencies
  34. shell: bash
  35. run: |
  36. curl -LsSf https://astral.sh/uv/install.sh | sh
  37. uv sync --dev --python=3.10 # tests for backwards compatibility
  38. uv pip install -r ch05/07_gpt_to_llama/tests/test-requirements-extra.txt
  39. uv add pytest-ruff nbval
  40. - name: Test Selected Python Scripts (uv)
  41. shell: bash
  42. run: |
  43. source .venv/bin/activate
  44. pytest --ruff setup/02_installing-python-libraries/tests.py
  45. pytest --ruff ch04/01_main-chapter-code/tests.py
  46. pytest --ruff ch05/01_main-chapter-code/tests.py
  47. pytest --ruff ch05/07_gpt_to_llama/tests/tests.py
  48. pytest --ruff ch05/12_gemma3/tests/test_gemma3.py
  49. pytest --ruff ch06/01_main-chapter-code/tests.py
  50. - name: Validate Selected Jupyter Notebooks (uv)
  51. shell: bash
  52. run: |
  53. source .venv/bin/activate
  54. pytest --ruff --nbval ch02/01_main-chapter-code/dataloader.ipynb
  55. pytest --ruff --nbval ch03/01_main-chapter-code/multihead-attention.ipynb
  56. pytest --ruff --nbval ch02/04_bonus_dataloader-intuition/dataloader-intuition.ipynb