Repository navigation
108 lines (95 loc) · 3.71 KB
/
Copy pathpython-ci.yml
File metadata and controls
108 lines (95 loc) · 3.71 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
# Copyright 2026 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
#
# http://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 ]
pull_request:
branches: [ main ]
# Cancel superseded pull_request runs when a newer commit is pushed to the same
# PR. Other events get a per-commit group, so they are never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: Python CI / build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout samples repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
path: a2ui-samples
persist-credentials: false
- name: Resolve core SDK branch
id: core_ref
env:
HEAD_REF: ${{ github.head_ref }}
run: |
RESOLVED_REF="main"
case "$HEAD_REF" in
test_*)
# Poll up to 80s for the parallel Copybara-Review-a2ui-core export to push test_<OCL>.
for ATTEMPT in $(seq 1 9); do
if git ls-remote --exit-code --heads https://github.com/googlemaps/a2ui.git "refs/heads/$HEAD_REF" >/dev/null 2>&1; then
RESOLVED_REF="$HEAD_REF"
break
fi
if [ "$ATTEMPT" -lt 9 ]; then
echo "Waiting 10s for Copybara to push $HEAD_REF to googlemaps/a2ui (attempt $ATTEMPT/9)..."
sleep 10
fi
done
if [ "$RESOLVED_REF" = "main" ]; then
echo "::warning::Branch $HEAD_REF not found on googlemaps/a2ui after 80s; falling back to main."
fi
;;
esac
echo "Using googlemaps/a2ui ref: $RESOLVED_REF"
echo "ref=$RESOLVED_REF" >> "$GITHUB_OUTPUT"
- name: Checkout core SDK repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
repository: googlemaps/a2ui
ref: ${{ steps.core_ref.outputs.ref }}
path: a2ui
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
enable-cache: auto
- name: Set up Python
run: uv python install 3.13
- name: Configure local MAUI SDK path and install dependencies
run: |
chmod +x setup.sh
./setup.sh ../../../a2ui/agent/python_agent
uv sync --all-groups
working-directory: a2ui-samples/agent/python
- name: Verify sample agent imports and CLI entrypoint
run: uv run python __main__.py --help
working-directory: a2ui-samples/agent/python
- name: Run unit tests
run: uv run python -m unittest discover -s . -p "test_*.py"
working-directory: a2ui-samples/agent/python
- name: Type check with pyright
run: uv run pyright
working-directory: a2ui-samples/agent/python
continue-on-error: true
- name: Lint with ruff
run: uv run ruff check .
working-directory: a2ui-samples/agent/python
continue-on-error: true