-
Notifications
You must be signed in to change notification settings - Fork 1
133 lines (112 loc) · 3.64 KB
/
Copy pathsdk-tests-lean.yml
File metadata and controls
133 lines (112 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: SDK Tests
# Fast SDK tests that run on every PR and push to main
# For comprehensive cross-platform testing, manually run sdk-tests.yml
on:
pull_request:
types: [opened, synchronize]
paths:
- "sdk/**"
- ".github/workflows/sdk-tests-lean.yml"
push:
branches:
- "release/**"
paths:
- "sdk/**"
- ".github/workflows/sdk-tests-lean.yml"
workflow_dispatch:
jobs:
test-python:
name: Python SDK Tests (Lean)
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdk/python
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: sdk/python/.venv
key: venv-${{ runner.os }}-python-3.11-${{ hashFiles('sdk/python/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-python-3.11-
venv-${{ runner.os }}-
- name: Install dependencies
run: poetry install --no-interaction
- name: Install optional integration test dependencies
run: |
# Install browser dependencies for browser-use tests
poetry run playwright install chromium --with-deps
continue-on-error: true
- name: Run linting
run: |
poetry run ruff check .
poetry run mypy .
continue-on-error: true
- name: Run unit tests with coverage
run: poetry run pytest tests/unit/ --cov --cov-report=xml --cov-report=term-missing -v
- name: Run SDK integration tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
if [ -n "$OPENAI_API_KEY" ]; then
echo "Running SDK integration tests..."
poetry run python run_integration_tests.py --verbose
else
echo "⚠️ OPENAI_API_KEY not set - skipping integration tests"
echo "Add OPENAI_API_KEY to repository secrets to enable integration tests"
fi
# - name: Upload coverage reports
# uses: codecov/codecov-action@v4
# with:
# file: ./sdk/python/coverage.xml
# flags: python-sdk
# name: python-sdk-coverage
# fail_ci_if_error: false
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-typescript:
name: TypeScript SDK Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdk/typescript
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
cache-dependency-path: sdk/typescript/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
continue-on-error: true
- name: Build TypeScript
run: npm run build
- name: Run tests with coverage
run: npm run test:coverage
# - name: Upload coverage reports
# uses: codecov/codecov-action@v4
# with:
# file: ./sdk/typescript/coverage/lcov.info
# flags: typescript-sdk
# name: typescript-sdk-coverage
# fail_ci_if_error: false
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}