Skip to content

Commit e2ddcf2

Browse files
shixishclaude
andcommitted
Add GitHub Actions CI for lint, typing, and tests
ci.yml runs on every push to main and every PR: lint + typing on 3.12, and unit tests across Python 3.10/3.13. integration.yml runs the live Diffbot suite nightly and on-demand using the DIFFBOT_API_TOKEN secret. CI installs with `uv sync --no-sources` so langchain-core / langchain-tests resolve from PyPI (the sibling ../langchain checkout in [tool.uv.sources] only exists locally), and sets UV_NO_SYNC so the make targets reuse the synced env. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8b4a1e7 commit e2ddcf2

4 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
env:
17+
# `[tool.uv.sources]` pins langchain-core / langchain-tests to a sibling
18+
# `../langchain/` checkout that does not exist on CI. `--no-sources` ignores
19+
# that table and resolves them from PyPI instead — the same path release
20+
# builds take. It forces re-resolution, so the lockfile is not used here.
21+
UV_NO_SYNC: "true"
22+
23+
jobs:
24+
lint:
25+
name: lint + typing
26+
runs-on: ubuntu-latest
27+
env:
28+
RUFF_OUTPUT_FORMAT: github
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: astral-sh/setup-uv@v5
32+
with:
33+
version: "0.9.5"
34+
python-version: "3.12"
35+
enable-cache: true
36+
- run: uv sync --no-sources --group lint --group typing
37+
- run: make lint
38+
- run: make typing
39+
40+
test:
41+
name: unit tests (py${{ matrix.python-version }})
42+
runs-on: ubuntu-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
python-version: ["3.10", "3.13"]
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: astral-sh/setup-uv@v5
50+
with:
51+
version: "0.9.5"
52+
python-version: ${{ matrix.python-version }}
53+
enable-cache: true
54+
- run: uv sync --no-sources --group test
55+
- run: make test
56+
- name: Check for unexpected file changes
57+
run: git diff --exit-code

.github/workflows/integration.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Integration
2+
3+
# Hits the live Diffbot APIs, so it consumes real quota and needs a token.
4+
# Kept off the per-PR path: nightly + on-demand only. Neither trigger can be
5+
# invoked by a fork PR, so the repo-level DIFFBOT_API_TOKEN secret is never
6+
# exposed to untrusted code.
7+
on:
8+
schedule:
9+
- cron: "0 6 * * *"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
env:
16+
UV_NO_SYNC: "true"
17+
18+
jobs:
19+
integration:
20+
name: integration tests
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: astral-sh/setup-uv@v5
25+
with:
26+
version: "0.9.5"
27+
python-version: "3.12"
28+
enable-cache: true
29+
- run: uv sync --no-sources --group test
30+
- run: make test_integration
31+
env:
32+
DIFFBOT_API_TOKEN: ${{ secrets.DIFFBOT_API_TOKEN }}

CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ make test # unit tests
6161
make test_integration # integration tests (needs DIFFBOT_API_TOKEN)
6262
```
6363

64+
## Continuous integration
65+
66+
`.github/workflows/ci.yml` runs on every push to `main` and every PR: `make lint` + `make typing` (Python 3.12) and `make test` (Python 3.10 and 3.13). `.github/workflows/integration.yml` runs `make test_integration` nightly and on-demand (`workflow_dispatch`), reading the repo-level `DIFFBOT_API_TOKEN` secret. It is kept off the per-PR path on purpose: neither `schedule` nor `workflow_dispatch` can be triggered by a fork PR, so the token is never exposed to untrusted code.
67+
68+
CI cannot use the `[tool.uv.sources]` table, which pins `langchain-core` / `langchain-tests` to the sibling `../langchain/` checkout that only exists locally. Every CI install is `uv sync --no-sources` (resolves those from PyPI, the same path release builds take) and sets `UV_NO_SYNC=true` so the `make` targets' `uv run` reuse the synced env instead of re-resolving against the sources table. `--no-sources` re-resolves, so `uv.lock` is not used in CI.
69+
6470
## Releasing
6571

6672
PyPI / TestPyPI tokens live in the macOS Keychain so the Makefile pulls them automatically — no plaintext on disk, no shell-history leaks. First-time (or post-rotation) setup:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# langchain-diffbot
22

3+
[![CI](https://github.com/diffbot/langchain-diffbot/actions/workflows/ci.yml/badge.svg)](https://github.com/diffbot/langchain-diffbot/actions/workflows/ci.yml)
4+
35
A thin LangChain integration over the official [`diffbot-python`](https://github.com/diffbot/diffbot-python) SDK. Every Diffbot API gets the closest LangChain primitive:
46

57
| Diffbot API | LangChain class(es) |

0 commit comments

Comments
 (0)