Repository navigation
128 lines (123 loc) · 4.74 KB
/
Copy pathpython_ci.yml
File metadata and controls
128 lines (123 loc) · 4.74 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
# 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/**"
- ".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/**"
- ".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.extensions.file_resolve, 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
run: uv run pytest
- 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