From dd147b018ddc3d268b9f702751aa1f302cfb7fd5 Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Mon, 16 Feb 2026 10:45:06 +0300 Subject: [PATCH 1/6] Create test.yml --- .github/workflows/test.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..033037d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: Test + +on: + push: + pull_request: + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + python-version: ['3.10'] + fail-fast: false + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up uv + uses: astral-sh/setup-uv@v7 + + - name: Install dependencies with uv + run: | + uv sync --extra cpu + + - name: Add nanochat to PYTHONPATH (Unix) + run: | + echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV + + - name: Run pytest + run: | + uv run pytest tests/ From 90cdd1b5b8d0248a1a7a02bfe2c1bb7d0dc5099a Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Mon, 16 Feb 2026 10:58:39 +0300 Subject: [PATCH 2/6] Update test.yml --- .github/workflows/test.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 033037d..c7adb32 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,10 +24,17 @@ jobs: - name: Set up uv uses: astral-sh/setup-uv@v7 - - - name: Install dependencies with uv + # Linux: Request 'cpu' extra to force the pytorch-cpu index (prevents libcublas crash) + - name: Install dependencies (Linux) + if: runner.os == 'Linux' run: | - uv sync --extra cpu + uv sync --extra cpu + uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu + + # macOS: Standard sync + - name: Install dependencies (macOS) + if: runner.os == 'macOS' + run: uv sync - name: Add nanochat to PYTHONPATH (Unix) run: | From 4c5cf36035e232f2cc6703212faf6e22f53f1909 Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Mon, 16 Feb 2026 11:01:16 +0300 Subject: [PATCH 3/6] Update test.yml --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7adb32..51541b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,4 +42,6 @@ jobs: - name: Run pytest run: | - uv run pytest tests/ + # uv run pytest tests/ + .venv/bin/pytest tests/ + From 3185f928d7568eea75a27438454ec390c08c28e4 Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Mon, 16 Feb 2026 13:47:08 +0300 Subject: [PATCH 4/6] Update .github/workflows/test.yml - trigger tests on push and pull request only on branch master Co-authored-by: Sofie Van Landeghem --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51541b0..8f82364 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,11 @@ name: Test on: push: + branches: + - master pull_request: + branches: + - master jobs: test: From 7686d3c7e289917da72b51886506d675b514b2de Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Mon, 16 Feb 2026 15:33:48 +0300 Subject: [PATCH 5/6] Update test.yml - adds manual trigger for testing on GH actions - adds --extra cpu parameter to uv run --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f82364..300b219 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - master + workflow_dispatch: jobs: test: @@ -46,6 +47,6 @@ jobs: - name: Run pytest run: | - # uv run pytest tests/ - .venv/bin/pytest tests/ + uv run --extra cpu pytest tests/ -v + From 3735eb9723fac51034ab96cfd23d63039a813ed0 Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:41:56 +0300 Subject: [PATCH 6/6] simplify test.yml - one command for both platforms --- .github/workflows/test.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 300b219..2f91015 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,24 +29,13 @@ jobs: - name: Set up uv uses: astral-sh/setup-uv@v7 - # Linux: Request 'cpu' extra to force the pytorch-cpu index (prevents libcublas crash) - name: Install dependencies (Linux) - if: runner.os == 'Linux' run: | uv sync --extra cpu - uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu - - # macOS: Standard sync - - name: Install dependencies (macOS) - if: runner.os == 'macOS' - run: uv sync - - name: Add nanochat to PYTHONPATH (Unix) run: | echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV - - name: Run pytest run: | uv run --extra cpu pytest tests/ -v -