Repository navigation
131 lines (124 loc) · 4.4 KB
/
Copy pathci.yml
File metadata and controls
131 lines (124 loc) · 4.4 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
name: ci
on: [push, pull_request, workflow_dispatch]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v7
with:
python-version: "3.10"
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Compile
run: poetry run mypy .
package:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up python
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Test release validation
run: python -m unittest discover -s .github/scripts -p 'test_*.py' -v
- name: Verify release commit and version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main
bash .github/scripts/verify-release-commit.sh
python .github/scripts/validate-release.py
- name: Install packaging tools
run: python -m pip install "build>=1.2,<2" "twine>=6,<7"
- name: Build and validate distributions
run: |
python -m build --outdir dist
python -m twine check --strict dist/*
- name: Upload Python distributions
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-distributions
path: |
dist/*.whl
dist/*.tar.gz
if-no-files-found: error
retention-days: 1
test:
needs: package
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
pydantic: [">=2,<3"]
include:
- python: "3.10"
pydantic: ">=1.10.26,<2"
- python: "3.12"
pydantic: ">=1.10.26,<2"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
- name: Download Python distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-distributions
path: dist
- name: Install built wheel
env:
PYDANTIC_REQUIREMENT: ${{ matrix.pydantic }}
run: |
python -m pip install dist/*.whl "pydantic$PYDANTIC_REQUIREMENT" "pytest>=8.2,<9" "pytest-asyncio>=1,<2" "pytest-xdist>=3.6.1,<4" "python-dateutil>=2.9,<3"
python -m pip check
- name: Test
run: python -m pytest -rP -n auto tests
- name: Install aiohttp extra
run: python -m pip install "$(find dist -name '*.whl')[aiohttp]"
- name: Test (aiohttp)
run: python -m pytest -rP -n auto -m aiohttp tests
- name: Verify installed package version and request headers
run: |
python - <<'PY'
import importlib.metadata
from vapi.core.client_wrapper import BaseClientWrapper
version = importlib.metadata.version("vapi_server_sdk")
headers = BaseClientWrapper(token="ci-test", base_url="https://api.vapi.ai").get_headers()
assert headers["X-Fern-SDK-Version"] == version
assert headers["User-Agent"] == f"vapi_server_sdk/{version}"
PY
publish:
needs: [compile, package, test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
timeout-minutes: 5
environment: pypi
permissions:
id-token: write
steps:
# No checkout, dependency installation, or package build in this job.
- name: Download Python distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-distributions
path: dist
- name: Publish tested distributions to PyPI
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1