You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
Update breaking-change-detector.yml
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required for griffe.load_git to access main branch history
|
||||
fetch-depth: 0 # Required for griffe.load_git to access 'main' history
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
@@ -25,42 +25,42 @@ jobs:
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: Install dependencies
|
||||
# Syncing extras (like test) ensures 'google-auth' and other 'google.*'
|
||||
# namespaces are populated, preventing ModuleNotFound errors.
|
||||
# 1. uv sync installs the SDK (google-auth, pydantic, etc.)
|
||||
# 2. uv pip install griffe ensures the detector tool is in the venv
|
||||
run: |
|
||||
uv sync --extra test
|
||||
uv pip install griffe
|
||||
|
||||
- name: Run Breaking Change Detection
|
||||
shell: python
|
||||
# Using 'uv run python' is the key: it automatically runs the script
|
||||
# inside the .venv created in the previous step, so both 'griffe'
|
||||
# and 'google' are found.
|
||||
run: |
|
||||
uv run python - <<EOF
|
||||
import sys
|
||||
import griffe
|
||||
from griffe import find_breaking_changes, load, load_git
|
||||
|
||||
# The package 'google.adk' is located inside the 'src' directory.
|
||||
# Specifying search_paths=["src"] allows Griffe to find it.
|
||||
try:
|
||||
print("Loading current API version...")
|
||||
print("Loading current API (from PR)...")
|
||||
# We use 'google.adk' and tell Griffe to look in 'src'
|
||||
new_api = load("google.adk", search_paths=["src"])
|
||||
|
||||
print("Loading baseline API version from main branch...")
|
||||
# load_git automatically handles the temporary checkout of the ref.
|
||||
print("Loading baseline API (from main branch)...")
|
||||
# search_paths=["src"] is also required here to find the package in the worktree
|
||||
old_api = load_git("google.adk", ref="main", search_paths=["src"])
|
||||
|
||||
print("Comparing versions for breaking changes...")
|
||||
print("Comparing for breaking changes...")
|
||||
breakages = list(find_breaking_changes(old_api, new_api))
|
||||
|
||||
if breakages:
|
||||
# Annotation for GitHub Actions UI
|
||||
print(f"::error::Found {len(breakages)} breaking changes!")
|
||||
for breakage in breakages:
|
||||
# .explain() provides details on what was removed or changed
|
||||
print(breakage.explain())
|
||||
sys.exit(1)
|
||||
|
||||
print("Success: No breaking changes detected.")
|
||||
except Exception as e:
|
||||
# If Griffe fails (e.g., due to the 'google' module error), we fail the check.
|
||||
print(f"::error::Breaking change detection failed: {e}")
|
||||
sys.exit(1)
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user