From 42f3a8f6b91ce2dd3659cb1af349d04544d809f2 Mon Sep 17 00:00:00 2001 From: LiberiFatali Date: Sun, 9 Aug 2026 08:45:08 +0700 Subject: [PATCH] ci: add GitHub Actions workflow (test + lint) Two blocking jobs on PRs to main and pushes to main, using the pinned requirements.txt so runs are deterministic on pydantic-ai 1.0.6: - test: installs the freeze + dev tools, installs the package with --no-deps so pip never re-resolves dependency floors, runs pytest. - lint: runs ruff check (github-format annotations) and ruff format --check on only the .py files changed in the PR, so pre-existing repo-wide debt never blocks unrelated PRs. --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6d94db5a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +permissions: + contents: read + +jobs: + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install pytest pytest-asyncio pytest-cov ruff + pip install -e . --no-deps + + - name: Run tests + run: pytest -p no:cacheprovider -o addopts="" tests/ -q + + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install ruff + run: pip install ruff + + - name: Ruff check changed files + run: | + git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" -- '*.py' \ + | xargs -r ruff check --output-format=github + + - name: Ruff format check changed files + run: | + git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" -- '*.py' \ + | xargs -r ruff format --check