Skip to content

Commit 644cff2

Browse files
committed
ci: add sdk validation script
1 parent c5e1feb commit 644cff2

7 files changed

Lines changed: 45 additions & 120 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,48 +24,5 @@ jobs:
2424
with:
2525
enable-cache: true
2626

27-
- name: Install dependencies
28-
run: uv sync --all-groups
29-
30-
- name: Verify OpenAPI contract
31-
run: uv run python scripts/verify_openapi_contract.py
32-
33-
- name: Run tests
34-
run: uv run pytest -q
35-
36-
- name: Ruff
37-
run: uv run ruff check .
38-
39-
- name: mypy
40-
run: uv run mypy src/calle
41-
42-
- name: Compile examples
43-
run: uv run python -m py_compile examples/create_and_wait.py examples/webhook_server.py
44-
45-
- name: Build package
46-
run: uv build
47-
48-
- name: Check distribution metadata
49-
run: uvx twine check dist/*
50-
51-
- name: Smoke test wheel install
52-
run: |
53-
set -euo pipefail
54-
55-
smoke_dir="$(mktemp -d)"
56-
python -m venv "$smoke_dir/.venv"
57-
. "$smoke_dir/.venv/bin/activate"
58-
python -m pip install --upgrade pip
59-
python -m pip install dist/*.whl
60-
python -c 'from calle import CalleClient; print(CalleClient)'
61-
62-
- name: Smoke test source distribution install
63-
run: |
64-
set -euo pipefail
65-
66-
smoke_dir="$(mktemp -d)"
67-
python -m venv "$smoke_dir/.venv"
68-
. "$smoke_dir/.venv/bin/activate"
69-
python -m pip install --upgrade pip
70-
python -m pip install dist/*.tar.gz
71-
python -c 'from calle import CalleClient; print(CalleClient)'
27+
- name: Run validation
28+
run: bash scripts/validate.sh

.github/workflows/publish-python.yml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -43,51 +43,8 @@ jobs:
4343
with:
4444
enable-cache: true
4545

46-
- name: Install dependencies
47-
run: uv sync --all-groups
48-
49-
- name: Verify OpenAPI contract
50-
run: uv run python scripts/verify_openapi_contract.py
51-
52-
- name: Run tests
53-
run: uv run pytest -q
54-
55-
- name: Ruff
56-
run: uv run ruff check .
57-
58-
- name: mypy
59-
run: uv run mypy src/calle
60-
61-
- name: Compile examples
62-
run: uv run python -m py_compile examples/create_and_wait.py examples/webhook_server.py
63-
64-
- name: Build package
65-
run: uv build
66-
67-
- name: Check distribution metadata
68-
run: uvx twine check dist/*
69-
70-
- name: Smoke test wheel install
71-
run: |
72-
set -euo pipefail
73-
74-
smoke_dir="$(mktemp -d)"
75-
python -m venv "$smoke_dir/.venv"
76-
. "$smoke_dir/.venv/bin/activate"
77-
python -m pip install --upgrade pip
78-
python -m pip install dist/*.whl
79-
python -c 'from calle import CalleClient; print(CalleClient)'
80-
81-
- name: Smoke test source distribution install
82-
run: |
83-
set -euo pipefail
84-
85-
smoke_dir="$(mktemp -d)"
86-
python -m venv "$smoke_dir/.venv"
87-
. "$smoke_dir/.venv/bin/activate"
88-
python -m pip install --upgrade pip
89-
python -m pip install dist/*.tar.gz
90-
python -c 'from calle import CalleClient; print(CalleClient)'
46+
- name: Run validation
47+
run: bash scripts/validate.sh
9148

9249
- name: Publish with package index token
9350
if: inputs.auth == 'token'

CONTRIBUTING.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ trusted backend services, workers, and automation systems.
66
## Development setup
77

88
```bash
9-
uv sync --all-groups
10-
uv run pytest -q
11-
uv run ruff check .
12-
uv run mypy src/calle
13-
uv run python -m py_compile examples/create_and_wait.py examples/webhook_server.py
14-
uv build
15-
uvx twine check dist/*
9+
bash scripts/validate.sh
1610
```
1711

1812
## Local examples

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ Before the first registry publish, use a local checkout for development and
3636
package smoke tests:
3737

3838
```bash
39-
uv sync --all-groups
40-
uv run python scripts/verify_openapi_contract.py
41-
uv run pytest -q
42-
uv build
39+
bash scripts/validate.sh
4340
```
4441

4542
## Examples

RELEASE.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,12 @@ integration testing.
2020
Run these checks before publishing:
2121

2222
```bash
23-
uv sync --all-groups
24-
uv run python scripts/verify_openapi_contract.py
25-
uv run pytest -q
26-
uv run ruff check .
27-
uv run mypy src/calle
28-
uv run python -m py_compile examples/create_and_wait.py examples/webhook_server.py
29-
uv build
30-
uvx twine check dist/*
31-
python -m venv /tmp/calle-python-sdk-smoke
32-
. /tmp/calle-python-sdk-smoke/bin/activate
33-
python -m pip install dist/*.whl
34-
python -c 'from calle import CalleClient; print(CalleClient)'
35-
deactivate
36-
python -m venv /tmp/calle-python-sdk-sdist-smoke
37-
. /tmp/calle-python-sdk-sdist-smoke/bin/activate
38-
python -m pip install dist/*.tar.gz
39-
python -c 'from calle import CalleClient; print(CalleClient)'
23+
bash scripts/validate.sh
4024
```
4125

42-
The CI workflow also installs the built wheel in a fresh virtual environment and
43-
imports `CalleClient`.
26+
The validation script checks the OpenAPI contract, tests, lint, types, examples,
27+
distribution metadata, wheel install, source distribution install, and imports
28+
`CalleClient` from fresh virtual environments.
4429

4530
## TestPyPI rehearsal
4631

scripts/smoke_install_dist.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
artifact="${1:?usage: bash scripts/smoke_install_dist.sh dist/<artifact>}"
5+
smoke_dir="$(mktemp -d)"
6+
trap 'rm -rf "$smoke_dir"' EXIT
7+
8+
if command -v python3 >/dev/null 2>&1; then
9+
python_cmd="python3"
10+
elif command -v python >/dev/null 2>&1; then
11+
python_cmd="python"
12+
else
13+
echo "Missing python3 or python on PATH." >&2
14+
exit 1
15+
fi
16+
17+
"$python_cmd" -m venv "$smoke_dir/.venv"
18+
. "$smoke_dir/.venv/bin/activate"
19+
python -m pip install --upgrade pip
20+
python -m pip install "$artifact"
21+
python -c 'from calle import CalleClient; print(CalleClient)'

scripts/validate.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
rm -rf dist
5+
uv sync --all-groups
6+
uv run python scripts/verify_openapi_contract.py
7+
uv run pytest -q
8+
uv run ruff check .
9+
uv run mypy src/calle
10+
uv run python -m py_compile examples/create_and_wait.py examples/webhook_server.py
11+
uv build
12+
uvx twine check dist/*
13+
bash scripts/smoke_install_dist.sh dist/*.whl
14+
bash scripts/smoke_install_dist.sh dist/*.tar.gz

0 commit comments

Comments
 (0)