Skip to content

Commit ddf47cc

Browse files
committed
Add tests in CI
1 parent 3633eda commit ddf47cc

File tree

3 files changed

+125
-0
lines changed

3 files changed

+125
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Setup uv"
2+
description: "Checks out code, installs uv, and sets up Python environment"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install uv
8+
uses: astral-sh/setup-uv@v3
9+
with:
10+
enable-cache: true
11+
cache-dependency-glob: "uv.lock"
12+
13+
- name: "Set up Python"
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version-file: "pyproject.toml"
17+
18+
- name: Restore uv cache
19+
uses: actions/cache@v4
20+
with:
21+
path: /tmp/.uv-cache
22+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
23+
restore-keys: |
24+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
25+
uv-${{ runner.os }}

.github/workflows/lint.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Python lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint_langchain:
13+
name: Lint LangChain - Python ${{ matrix.python-version }}
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash
18+
working-directory: ./langchain
19+
strategy:
20+
matrix:
21+
python-version: ['3.8', '3.13']
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.ref }}
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
with:
29+
enable-cache: true
30+
cache-dependency-glob: "uv.lock"
31+
- name: "Set up Python"
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version-file: "pyproject.toml"
35+
- name: Restore uv cache
36+
uses: actions/cache@v4
37+
with:
38+
path: /tmp/.uv-cache
39+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
40+
restore-keys: |
41+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
42+
uv-${{ runner.os }}
43+
- name: Install the project
44+
run: uv sync --dev
45+
- name: Run ruff format check
46+
run: uv run ruff format --check
47+
- name: Run ruff check
48+
run: uv run ruff check
49+
- name: Run mypy
50+
run: uv run mypy .
51+
- name: Minimize uv cache
52+
run: uv cache prune --ci

.github/workflows/python_test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Python tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-langchain:
13+
name: LangChain Unit Tests - Python ${{ matrix.python-version }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.ref }}
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v3
24+
with:
25+
enable-cache: true
26+
cache-dependency-glob: "uv.lock"
27+
- name: "Set up Python"
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Restore uv cache
32+
uses: actions/cache@v4
33+
with:
34+
path: /tmp/.uv-cache
35+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
36+
restore-keys: |
37+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
38+
uv-${{ runner.os }}
39+
- name: Install the project
40+
run: uv sync --dev
41+
- name: Run unit tests
42+
env:
43+
VECTORIZE_TOKEN: ${{ secrets.VECTORIZE_TOKEN }}
44+
VECTORIZE_ORG: ${{ secrets.VECTORIZE_ORG }}
45+
VECTORIZE_ENV: dev
46+
run: uv run pytest tests -vv
47+
- name: Minimize uv cache
48+
run: uv cache prune --ci

0 commit comments

Comments
 (0)