Skip to content

Commit 30d0b16

Browse files
author
Astraea Quinn S
authored
Install override sdk in integ tests
1 parent 0ada51c commit 30d0b16

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,58 @@ jobs:
4848
ssh-private-key: ${{ secrets.SDK_KEY }}
4949
- name: Check for Python Language SDK branch override in PR
5050
if: github.event_name == 'pull_request'
51+
env:
52+
GITHUB_EVENT_PATH: ${{ github.event_path }}
5153
run: |
52-
OVERRIDE=$(echo "${{ github.event.pull_request.body }}" | grep -o 'PYTHON_LANGUAGE_SDK_BRANCH: [^[:space:]]*' | cut -d' ' -f2 || true)
53-
if [ ! -z "$OVERRIDE" ]; then
54+
# Robust extraction: check PR title and body and accept ":" or "=" with optional spaces.
55+
OVERRIDE=$(
56+
python - <<'PY'
57+
import json, os, re
58+
ev_path = os.environ.get("GITHUB_EVENT_PATH")
59+
if not ev_path:
60+
raise SystemExit(0)
61+
with open(ev_path, "r") as f:
62+
ev = json.load(f)
63+
pr = ev.get("pull_request", {}) or {}
64+
text = "\n".join([pr.get("title","") or "", pr.get("body","") or ""])
65+
m = re.search(r'PYTHON_LANGUAGE_SDK_BRANCH\s*[:=]\s*([^\s]+)', text, re.IGNORECASE)
66+
if m:
67+
print(m.group(1))
68+
PY
69+
)
70+
if [ -n "$OVERRIDE" ]; then
5471
echo "AWS_DURABLE_SDK_URL=git+ssh://git@github.com/aws/aws-durable-execution-sdk-python.git@$OVERRIDE" >> $GITHUB_ENV
5572
echo "Using Python Language SDK branch override: $OVERRIDE"
5673
else
5774
echo "Using default Python Language SDK (main branch)"
5875
fi
76+
77+
- name: Install Python Language SDK override into hatch environment (if provided)
78+
if: env.AWS_DURABLE_SDK_URL != ''
79+
run: |
80+
echo "Detected AWS_DURABLE_SDK_URL=$AWS_DURABLE_SDK_URL"
81+
python -m pip install --upgrade pip
82+
# Prefer installing inside hatch environment so hatch run test:examples picks it up.
83+
# Install (force reinstall) the branch into hatch's environment. If hatch env doesn't exist
84+
# or hatch run fails, fall back to system pip install.
85+
set -e
86+
if hatch run true 2>/dev/null; then
87+
echo "Installing SDK override inside hatch environment..."
88+
hatch run pip install --upgrade --force-reinstall "$AWS_DURABLE_SDK_URL"
89+
else
90+
echo "hatch run not available or failed; falling back to system pip install..."
91+
python -m pip install --upgrade --force-reinstall "$AWS_DURABLE_SDK_URL"
92+
fi
93+
# Sanity check: show where the installed package comes from
94+
python - <<'PY'
95+
import importlib, sys
96+
try:
97+
m = importlib.import_module("aws_durable_execution_sdk_python")
98+
print("aws_durable_execution_sdk_python.__file__:", getattr(m, "__file__", "<no __file__>"))
99+
except Exception as e:
100+
print("Failed to import aws_durable_execution_sdk_python:", e)
101+
PY
102+
59103
- name: static analysis
60104
run: hatch fmt --check
61105
- name: type checking

0 commit comments

Comments
 (0)