From 6a958528b39f03deada95b3a26348f1b0ff19ed4 Mon Sep 17 00:00:00 2001 From: Leandro Martin Soler Date: Sun, 15 Jun 2025 19:49:45 -0300 Subject: [PATCH] Adding a Github workflow to lint and test the code --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ pyproject.toml | 8 ++++++-- tests/test_agent.py | 2 -- uv.lock | 10 ++++++++-- 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e502ee6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: Continuous Integration +# This workflow runs on every push and pull request to the main branch. + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + ci: + name: Continuous Integration + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + version: "0.7.6" + enable-cache: true + cache-dependency-glob: "uv.lock" + + - name: "Set up Python" + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + + - name: "Install the project dependencies" + run: uv sync --locked --all-extras --dev + + - name: "Run the linter" + run: uv run ruff check + + - name: "Run the tests" + run: uv run pytest \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2661b3c..5559131 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,8 +6,6 @@ readme = "README.md" requires-python = ">=3.12" dependencies = [ "google-adk>=1.3.0", - "pytest>=8.4.0", - "ruff>=0.11.13", ] [tool.ruff] @@ -15,3 +13,9 @@ line-length = 100 [tool.ruff.lint] select = ["E", "F", "W", "I"] + +[dependency-groups] +dev = [ + "pytest>=8.4.0", + "ruff>=0.11.13", +] diff --git a/tests/test_agent.py b/tests/test_agent.py index dfd2ece..ca97302 100644 --- a/tests/test_agent.py +++ b/tests/test_agent.py @@ -1,5 +1,3 @@ -import pytest - from git_diff_critique_agent import agent diff --git a/uv.lock b/uv.lock index 55882ef..3aeb818 100644 --- a/uv.lock +++ b/uv.lock @@ -221,13 +221,19 @@ version = "0.1.0" source = { virtual = "." } dependencies = [ { name = "google-adk" }, +] + +[package.dev-dependencies] +dev = [ { name = "pytest" }, { name = "ruff" }, ] [package.metadata] -requires-dist = [ - { name = "google-adk", specifier = ">=1.3.0" }, +requires-dist = [{ name = "google-adk", specifier = ">=1.3.0" }] + +[package.metadata.requires-dev] +dev = [ { name = "pytest", specifier = ">=8.4.0" }, { name = "ruff", specifier = ">=0.11.13" }, ]