Repository navigation
182 lines (176 loc) · 7.33 KB
/
Copy pathpython_ci.yml
File metadata and controls
182 lines (176 loc) · 7.33 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
# 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: 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