From ec48e413cded0f64151460245893afa4371340d9 Mon Sep 17 00:00:00 2001 From: chaitanyaam <147836528+chaitanyaam@users.noreply.github.com> Date: Sat, 21 Mar 2026 23:24:09 +0530 Subject: [PATCH 1/2] ci: add GitHub Actions CI workflow with python matrix --- .github/workflows/ci.yml | 61 ++++++++++++++++------------------------ pyproject.toml | 6 ++++ 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed87922..494b6d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,44 +7,33 @@ on: branches: [main] jobs: - lint: + test: runs-on: ubuntu-latest - + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - fetch-depth: 0 + python-version: ${{ matrix.python-version }} - - name: Install uv - uses: astral-sh/setup-uv@v7 + - name: Cache pip dependencies + uses: actions/cache@v4 with: - version: "0.10.8" - enable-cache: true - - - - name: Set up Python - run: uv python install 3.10 && uv venv --python 3.10 - - - name: Install dependencies - run: uv sync --locked - - - name: Run Ruff Check - run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - git fetch origin main - git diff --diff-filter=ACMR --name-only -z origin/main...HEAD -- '*.py' \ - | xargs -0 -r uv run ruff check -- - else - uv run ruff check . - fi - - - name: Run Ruff Format - run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - git fetch origin main - git diff --diff-filter=ACMR --name-only -z origin/main...HEAD -- '*.py' \ - | xargs -0 -r uv run ruff format --check -- - else - uv run ruff format --check . - fi \ No newline at end of file + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- + + - name: Install package and dev dependencies + run: pip install -e ".[dev]" + + - name: Run linter + run: ruff check openverifiablellm/ + + - name: Run tests + run: pytest tests/ -v --tb=short \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 96523a0..5f64b03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,12 @@ dependencies = [ "tokenizers==0.15.2" ] +[project.optional-dependencies] +dev = [ + "pytest>=7.0", + "ruff>=0.15.4", +] + [tool.setuptools.packages.find] include = ["openverifiablellm*"] From f3101f576c527dbdf4991ae844205a7d2b0d0307 Mon Sep 17 00:00:00 2001 From: chaitanyaam <147836528+chaitanyaam@users.noreply.github.com> Date: Sat, 21 Mar 2026 23:40:42 +0530 Subject: [PATCH 2/2] matrix now has 3.9, added inline comment in pyproject --- .github/workflows/ci.yml | 5 +++-- pyproject.toml | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 494b6d6..cf075fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,9 @@ jobs: test: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -36,4 +37,4 @@ jobs: run: ruff check openverifiablellm/ - name: Run tests - run: pytest tests/ -v --tb=short \ No newline at end of file + run: pytest tests/ -v --tb=short diff --git a/pyproject.toml b/pyproject.toml index 5f64b03..21a38dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,8 @@ dependencies = [ "tokenizers==0.15.2" ] +# Intentionally duplicated from [dependency-groups] below. +# pip uses this section; uv/PEP 735 uses [dependency-groups]. Keep both in sync. [project.optional-dependencies] dev = [ "pytest>=7.0", @@ -26,6 +28,8 @@ dev = [ [tool.setuptools.packages.find] include = ["openverifiablellm*"] +# Intentionally duplicated from [project.optional-dependencies] above. +# uv/PEP 735 uses this section; pip uses [project.optional-dependencies]. Keep both in sync. [dependency-groups] dev = [ "pytest>=7.0",