Skip to content

Commit e5e15a8

Browse files
authored
Update breaking-change-detector.yml
1 parent 20590de commit e5e15a8

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

.github/workflows/breaking-change-detector.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616
with:
17-
fetch-depth: 0 # Crucial for griffe.load_git to access the main branch history
17+
fetch-depth: 0 # Required for griffe.load_git to access main branch history
1818

1919
- name: Set up Python
2020
uses: actions/setup-python@v5
2121
with:
2222
python-version: '3.10'
2323

24-
- name: Install Griffe
25-
run: pip install griffe
24+
- name: Install the latest version of uv
25+
uses: astral-sh/setup-uv@v5
26+
27+
- name: Install dependencies
28+
# Syncing extras (like test) ensures 'google-auth' and other 'google.*'
29+
# namespaces are populated, preventing ModuleNotFound errors.
30+
run: |
31+
uv sync --extra test
32+
uv pip install griffe
2633
2734
- name: Run Breaking Change Detection
2835
shell: python
@@ -31,26 +38,29 @@ jobs:
3138
import griffe
3239
from griffe import find_breaking_changes, load, load_git
3340
34-
# 1. Load the current PR version from the local source
35-
# The adk-python source is located in src/google/adk
41+
# The package 'google.adk' is located inside the 'src' directory.
42+
# Specifying search_paths=["src"] allows Griffe to find it.
3643
try:
37-
new_api = load("src/google/adk")
44+
print("Loading current API version...")
45+
new_api = load("google.adk", search_paths=["src"])
3846
39-
# 2. Load the 'main' version for comparison
40-
# Griffe will look at the main branch's version of the package
41-
old_api = load_git("google.adk", ref="main")
47+
print("Loading baseline API version from main branch...")
48+
# load_git automatically handles the temporary checkout of the ref.
49+
old_api = load_git("google.adk", ref="main", search_paths=["src"])
4250
43-
# 3. Detect and explain breaking changes
51+
print("Comparing versions for breaking changes...")
4452
breakages = list(find_breaking_changes(old_api, new_api))
4553
4654
if breakages:
55+
# Annotation for GitHub Actions UI
4756
print(f"::error::Found {len(breakages)} breaking changes!")
4857
for breakage in breakages:
49-
# .explain() provides a human-readable reason for the breakage
58+
# .explain() provides details on what was removed or changed
5059
print(breakage.explain())
5160
sys.exit(1)
5261
53-
print("No breaking changes detected.")
62+
print("Success: No breaking changes detected.")
5463
except Exception as e:
55-
print(f"::warning::Breaking change detection failed: {e}")
56-
# We don't exit 1 here to prevent CI failure if the tool itself crashes
64+
# If Griffe fails (e.g., due to the 'google' module error), we fail the check.
65+
print(f"::error::Breaking change detection failed: {e}")
66+
sys.exit(1)

0 commit comments

Comments
 (0)