Skip to content

A straightforward method for training your LLM, from downloading data to generating text.

ci: lint, type-check and test on Linux, Windows and macOS

FareedKhan-dev8c91fe8e7d65
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..79bbff1
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,79 @@
+name: ci
+
+# Lint, type-check and test every push and pull request on CPU-only machines.
+# Nothing here needs a GPU: the tests use tiny models, and the end-to-end test trains every
+# stage for a few steps on generated data.
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ workflow_dispatch: {}
+
+concurrency:
+ group: ci-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: astral-sh/setup-uv@v10
+ - name: ruff
+ run: uvx ruff check .
+
+ types:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: astral-sh/setup-uv@v10
+ with:
+ python-version: "3.12"
+ - name: Install (CPU-only torch)
+ run: |
+ uv venv
+ uv pip install torch --index-url https://download.pytorch.org/whl/cpu
+ uv pip install -e . mypy
+ - name: mypy
+ run: uv run --no-sync mypy
+
+ test:
+ name: test (${{ matrix.os }}, py${{ matrix.python }})
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - { os: ubuntu-latest, python: "3.10" }
+ - { os: ubuntu-latest, python: "3.13" }
+ - { os: windows-latest, python: "3.12" }
+ - { os: macos-latest, python: "3.12" }
+ steps:
+ - uses: actions/checkout@v7
+ - uses: astral-sh/setup-uv@v10
+ with:
+ python-version: ${{ matrix.python }}
+ - name: Install (CPU-only torch)
+ shell: bash
+ run: |
+ uv venv
+ # Linux wheels on PyPI bundle CUDA (~2.5 GB); the CPU index avoids that. Windows and
+ # macOS wheels on PyPI are already CPU / MPS builds.
+ if [ "$RUNNER_OS" = "Linux" ]; then
+ uv pip install torch --index-url https://download.pytorch.org/whl/cpu
+ fi
+ uv pip install -e . pytest beartype
+ - name: pytest
+ run: uv run --no-sync pytest -q
+
+ docs:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: astral-sh/setup-uv@v10
+ - name: Build the documentation site (strict, catches broken links)
+ run: uvx --with mkdocs-material --with pymdown-extensions mkdocs build --strict --site-dir site
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index dc4672f..dea0af5 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -1,8 +1,9 @@
name: docs
# Build the MkDocs Material site and publish it via GitHub Pages.
-# Pages "Source" must be set to "GitHub Actions" (Settings -> Pages) — which it already is.
+# Pages "Source" must be set to "GitHub Actions" (Settings -> Pages), which it already is.
# No gh-pages branch needed; this uses the official Pages deployment actions.
+# (Pull requests build the site in ci.yml without deploying it.)
on:
push:
@@ -27,16 +28,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-python@v5
+ - uses: actions/checkout@v7
+ - uses: actions/setup-python@v7
with:
- python-version: "3.11"
+ python-version: "3.12"
- name: Install docs dependencies
run: pip install mkdocs mkdocs-material pymdown-extensions
- name: Build the site (strict)
run: mkdocs build --strict --site-dir ./site
- - uses: actions/configure-pages@v5
- - uses: actions/upload-pages-artifact@v3
+ - uses: actions/configure-pages@v6
+ - uses: actions/upload-pages-artifact@v5
with:
path: ./site
@@ -48,4 +49,4 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
- uses: actions/deploy-pages@v4
+ uses: actions/deploy-pages@v5