mirror of
https://github.com/karpathy/nanochat.git
synced 2026-05-04 15:00:28 +00:00
Add GitHub Actions workflow for testing Python code
GH workflow that - installs with uv - tests with pytest
This commit is contained in:
parent
0f007889dd
commit
e238750824
58
.github/workflows/base.yml
vendored
Normal file
58
.github/workflows/base.yml
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
python -m pip install uv
|
||||
|
||||
- name: Create virtual environment with uv
|
||||
run: |
|
||||
uv venv .venv
|
||||
|
||||
- name: Activate virtual environment
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
|
||||
- name: Install dependencies with uv
|
||||
run: |
|
||||
uv pip install . --system
|
||||
|
||||
- name: Add nanochat to PYTHONPATH
|
||||
run: |
|
||||
echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV
|
||||
|
||||
- name: Install pytest
|
||||
run: |
|
||||
python -m pip install pytest
|
||||
|
||||
- name: Run pytest
|
||||
run: |
|
||||
python -m pytest tests/ --maxfail=5 --disable-warnings
|
||||
|
||||
- name: Cache pip dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
Loading…
Reference in New Issue
Block a user