Repository navigation
259 lines (252 loc) · 10.7 KB
/
Copy pathpython_ci.yml
File metadata and controls
259 lines (252 loc) · 10.7 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Python CI
on:
push:
branches: [main]
paths:
- "python/**"
- "specification/**/json/**"
- "specification/inference_formats/**"
- "catalogs/**"
- "conformance/**"
- "samples/agent/adk/**"
- "tools/build_catalog/**"
- ".agents/skills/**"
- "dart/a2ui_cli/**"
- "scripts/run_skills_tests.py"
- ".github/scripts/**"
- ".github/workflows/python_ci.yml"
- ".github/actions/setup-python/**"
pull_request:
paths:
- "python/**"
- "specification/**/json/**"
- "specification/inference_formats/**"
- "catalogs/**"
- "conformance/**"
- "samples/agent/adk/**"
- "tools/build_catalog/**"
- ".agents/skills/**"
- "dart/a2ui_cli/**"
- "scripts/run_skills_tests.py"
- ".github/scripts/**"
- ".github/workflows/python_ci.yml"
- ".github/actions/setup-python/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
python-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# a2ui_core and a2ui_agent derive their versions from git tags, so
# the tags have to be present. Without this the build silently falls
# back to the version pinned in pyproject.toml and CI would never
# exercise the real versioning path.
fetch-depth: 0
- uses: ./.github/actions/setup-python
- name: Verify SDK version tags are reachable
env:
TARGET_BRANCH: ${{ github.base_ref || github.ref_name }}
run: |
set -euo pipefail
for glob in 'python/a2ui-core/v*' 'python/a2ui-agent-sdk/v*'; do
if ! git describe --tags --match "$glob" >/dev/null 2>&1; then
if [ "$TARGET_BRANCH" != "main" ]; then
echo "::warning::No tag matching $glob is reachable on branch $TARGET_BRANCH; fallback version will be used."
continue
fi
echo "::error::No tag matching $glob is reachable, so package" \
"versions would fall back instead of coming from tags."
exit 1
fi
echo "$glob -> $(git describe --tags --match "$glob")"
done
- name: Install Dependencies
run: uv sync --all-packages
- name: Check Agent SDK Installs Without Agent Frameworks
# The workspace venv has every package installed, so this check uses an
# isolated environment with only a2ui-core and a2ui-agent-sdk.
run: |
uv run --isolated --no-project \
--with ./python/a2ui_core --with ./python/a2ui_agent \
python -c "
import importlib.util
import a2ui.inference_formats, a2ui.parser, a2ui.processor
leaked = [m for m in ('a2a', 'google.adk', 'google.genai') if importlib.util.find_spec(m.split('.')[0]) and importlib.util.find_spec(m)]
assert not leaked, f'a2ui-agent-sdk pulls in agent frameworks: {leaked}'
"
- name: Check Experimental Package Installs Without Agent Frameworks or HTTP Clients
run: |
uv run --isolated --no-project \
--with ./python/a2ui_core --with ./python/a2ui_agent --with ./python/a2ui_agent_experimental \
python -c "
import importlib.util
import a2ui.experimental.decision
leaked = [m for m in ('a2a', 'google.adk', 'google.genai', 'httpx') if importlib.util.find_spec(m.split('.')[0]) and importlib.util.find_spec(m)]
assert not leaked, f'a2ui-agent-experimental pulls in forbidden dependencies: {leaked}'
"
- name: Set Up Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
java-version: "21"
distribution: "temurin"
- name: Check Generated Express Parser
run: uv run python python/a2ui_agent/scripts/generate_express_parser.py --check
- name: Check Formatting
run: |
uv run pyink --check .
- name: Type Check
run: |
uv run --all-packages mypy .
- name: Run Unit Tests
env:
A2UI_CONFORMANCE_MANIFEST_DIR: ${{ runner.temp }}/a2ui-manifest
run: uv run pytest
- name: Verify Core Conformance Manifest
run: |
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--harness python-core \
--corpus core
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--corpus extensions \
--only 'extensions/a2a/**' \
--harness python-a2a
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--corpus extensions \
--only 'extensions/adk/**' \
--harness python-adk
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--corpus agent \
--harness python-agent
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--corpus e2e \
--harness python-agent
- name: Verify Conformance Feature Coverage
run: |
uv run --project conformance python conformance/scripts/check_feature_coverage.py --static
for h in python-core python-agent python-a2a python-adk; do
uv run --project conformance python conformance/scripts/check_feature_coverage.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--harness "$h"
done
- name: Set Up Dart
uses: ./.github/actions/setup-dart
- name: Run CLI Python Runtime Tests
env:
REQUIRE_PYTHON_TESTS: "true"
run: |
cd dart/a2ui_cli
flutter pub get
VIRTUAL_ENV="$GITHUB_WORKSPACE/.venv" flutter test test/python_runtime_test.dart
- name: Build All Packages
run: uv build --all
- name: Run Skills Unit Tests
run: uv run python3 scripts/run_skills_tests.py
- name: Run Workflow Script Unit Tests
run: python3 -m unittest discover -s .github/scripts/tests
# The tests marked `performance` time processing payloads of two sizes, as
# conformance/core/message_processor_scaling.yaml describes. A slow or loaded
# runner can fail them, so the root pyproject.toml deselects them in the job
# above and they run here, in a job of their own. A regression can make them
# run for minutes, so the job has a time limit of its own.
python-performance:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-python
- name: Install Dependencies
run: uv sync --all-packages
- name: Run Performance Tests
run: uv run pytest -m performance python/a2ui_core/tests python/a2ui_agent/tests
# Default python-ci stays on a2a-sdk 0.3: workspace members (samples) still
# pin <0.4, so `uv sync --all-packages` cannot resolve 1.x. This sibling job
# installs a2ui-a2a and a2ui-adk with a2a-sdk 1.x in an isolated venv.
python-ci-a2a-sdk-1x:
name: Python CI (a2a-sdk 1.x)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-python
- name: Install a2ui-a2a and a2ui-adk with a2a-sdk 1.x
run: |
uv venv .venv-a2a-sdk-1x
venv="$PWD/.venv-a2a-sdk-1x"
core="$PWD/python/a2ui_core"
agent="$PWD/python/a2ui_agent"
a2a_ext="$PWD/python/a2ui_a2a"
adk="$PWD/python/a2ui_adk"
# uv pip install from the workspace root applies constraint-dependencies
# (a2a-sdk<0.4). Run from /tmp so only a2ui-a2a's pin (<2) applies.
# google-adk 2.3's a2a extra cannot resolve a2a-sdk 1.x. 2.14.0 is the
# first release whose A2A executor speaks 1.x task states.
cd /tmp
uv pip install --python "$venv" \
-e "$core" \
-e "$agent" \
-e "$a2a_ext" \
-e "$adk[a2a]" \
"a2a-sdk>=1.0.0,<2" \
"google-adk[a2a]>=2.14.0" \
mypy \
types-jsonschema \
types-PyYAML \
types-regex \
pytest \
pytest-asyncio
- name: Show a2a-sdk version
run: |
.venv-a2a-sdk-1x/bin/python -c "import importlib.metadata as m; print('a2a-sdk', m.version('a2a-sdk')); print('google-adk', m.version('google-adk'))"
- name: Type Check on a2a-sdk 1.x
run: |
.venv-a2a-sdk-1x/bin/mypy --config-file pyproject.toml \
python/a2ui_a2a/src \
python/a2ui_adk/src
# a2ui-agent-sdk doesn't use a2a-sdk, so its tests run only in python-ci.
- name: Run a2ui tests on a2a-sdk 1.x
env:
A2UI_CONFORMANCE_MANIFEST_DIR: ${{ runner.temp }}/a2ui-manifest
run: |
.venv-a2a-sdk-1x/bin/pytest \
python/a2ui_a2a/tests \
python/a2ui_adk/tests \
-q
- name: Verify A2A and ADK Conformance Manifests
run: |
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--corpus extensions \
--only 'extensions/a2a/**' \
--harness python-a2a
uv run --project conformance python conformance/scripts/check_executed_cases.py \
--manifest-dir "${{ runner.temp }}/a2ui-manifest" \
--corpus extensions \
--only 'extensions/adk/**' \
--harness python-adk