Skip to content

Commit d5f2c2e

Browse files
authored
Merge pull request #67 from ayush-shah/claude/plan-sdk-examples-01NfCuC8U2P7pShtJhGqjfuj
2 parents 06e7146 + 79c936e commit d5f2c2e

30 files changed

+6357
-0
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Test SDK Examples
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'sdk-examples/**'
7+
- '.github/workflows/test-sdk-examples.yml'
8+
push:
9+
branches:
10+
- main
11+
- 'claude/**'
12+
paths:
13+
- 'sdk-examples/**'
14+
- '.github/workflows/test-sdk-examples.yml'
15+
16+
jobs:
17+
test:
18+
name: Test SDK Examples (Python 3.10)
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: write
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set up Python 3.10
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.10'
34+
cache: 'pip'
35+
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip setuptools wheel
39+
pip install --prefer-binary -r sdk-examples/requirements-test.txt
40+
41+
- name: Run tests with pytest and coverage
42+
working-directory: sdk-examples
43+
run: |
44+
pytest tests/ -v --cov=. --cov-report=term-missing --cov-report=xml --cov-report=html
45+
46+
- name: Verify coverage data exists
47+
working-directory: sdk-examples
48+
run: |
49+
if [ ! -f .coverage ]; then
50+
echo "Error: No coverage data found. Coverage was not collected."
51+
exit 1
52+
fi
53+
echo "Coverage data verified at .coverage"
54+
55+
- name: Coverage comment
56+
uses: py-cov-action/python-coverage-comment-action@v3
57+
if: github.event_name == 'pull_request'
58+
with:
59+
GITHUB_TOKEN: ${{ github.token }}
60+
MINIMUM_GREEN: 100
61+
MINIMUM_ORANGE: 90
62+
ANNOTATE_MISSING_LINES: true
63+
ANNOTATION_TYPE: warning
64+
COVERAGE_PATH: sdk-examples
65+
66+
- name: Generate coverage report
67+
if: always()
68+
working-directory: sdk-examples
69+
run: |
70+
pip install coverage
71+
coverage report --show-missing
72+
73+
lint:
74+
name: Lint SDK Examples
75+
runs-on: ubuntu-latest
76+
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v4
80+
81+
- name: Set up Python
82+
uses: actions/setup-python@v4
83+
with:
84+
python-version: '3.10'
85+
86+
- name: Install linting tools
87+
run: |
88+
python -m pip install --upgrade pip
89+
pip install ruff black isort
90+
91+
- name: Check formatting with black
92+
run: |
93+
black --check sdk-examples/*.py sdk-examples/tests/*.py || true
94+
95+
- name: Check import sorting with isort
96+
run: |
97+
isort --check-only sdk-examples/*.py sdk-examples/tests/*.py || true
98+
99+
- name: Lint with ruff
100+
run: |
101+
ruff check sdk-examples/*.py sdk-examples/tests/*.py || true
102+
103+
validate-examples:
104+
name: Validate Example Files
105+
runs-on: ubuntu-latest
106+
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Set up Python
112+
uses: actions/setup-python@v4
113+
with:
114+
python-version: '3.10'
115+
116+
- name: Install dependencies
117+
run: |
118+
python -m pip install --upgrade pip setuptools wheel
119+
pip install --prefer-binary -r sdk-examples/requirements-test.txt
120+
121+
- name: Validate Python syntax
122+
run: |
123+
python -m py_compile sdk-examples/*.py
124+
python -m py_compile sdk-examples/tests/*.py
125+
126+
- name: Check for common issues
127+
run: |
128+
# Check all files have proper docstrings (skip shebangs and encoding declarations)
129+
for file in sdk-examples/*.py; do
130+
if ! head -n 20 "$file" | grep -E '^("""|'"'"''"'"''"'"')' > /dev/null; then
131+
echo "Missing docstring in $file"
132+
exit 1
133+
fi
134+
done
135+
136+
- name: Verify all imports can be resolved
137+
working-directory: sdk-examples
138+
run: |
139+
python -c "import setup; import services; import entities; import metadata_ops; import lineage; import queries; import advanced"

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,58 @@ buildNumber.properties
133133
.classpath
134134

135135
node_modules/
136+
137+
### Python ###
138+
# Byte-compiled / optimized / DLL files
139+
__pycache__/
140+
*.py[cod]
141+
*$py.class
142+
143+
# C extensions
144+
*.so
145+
146+
# Distribution / packaging
147+
.Python
148+
dist/
149+
downloads/
150+
eggs/
151+
.eggs/
152+
lib/
153+
lib64/
154+
parts/
155+
sdist/
156+
var/
157+
wheels/
158+
*.egg-info/
159+
*.egg
160+
MANIFEST
161+
162+
# PyInstaller
163+
*.manifest
164+
*.spec
165+
166+
# Installer logs
167+
pip-log.txt
168+
pip-delete-this-directory.txt
169+
170+
# Unit test / coverage reports
171+
htmlcov/
172+
.tox/
173+
.nox/
174+
.coverage
175+
.coverage.*
176+
.cache
177+
nosetests.xml
178+
coverage.xml
179+
*.cover
180+
*.py,cover
181+
.hypothesis/
182+
.pytest_cache/
183+
184+
# Environments
185+
.env
186+
.venv
187+
env/
188+
ENV/
189+
env.bak/
190+
venv.bak/

0 commit comments

Comments
 (0)