1717 python-version : ["3.13"]
1818
1919 steps :
20- - name : Parse testing SDK branch from PR body (Python)
21- id : parse
22- shell : bash
23- run : |
24- set -euo pipefail
25-
26- python - << 'PYTHON'
27- import os
28- import re
29-
30- body = os.environ.get("PR_BODY", "") or ""
31- default_ref = "main"
32-
33- # Regex:
34- # - (?i) case-insensitive
35- # - TESTING_SDK_BRANCH
36- # - optional spaces
37- # - : or =
38- # - optional spaces
39- # - capture rest of line
40- pattern = re.compile(r"(?i)TESTING_SDK_BRANCH\s*[:=]\s*(.+)$")
41-
42- ref = None
43- for line in body.splitlines() :
44- m = pattern.search(line)
45- if m :
46- # Strip trailing whitespace
47- candidate = m.group(1).strip()
48- if candidate :
49- ref = candidate
50- break
51-
52- if not ref :
53- ref = default_ref
54-
55- github_output = os.environ.get("GITHUB_OUTPUT")
56- if not github_output :
57- raise SystemExit("GITHUB_OUTPUT not set")
58-
59- with open(github_output, "a", encoding="utf-8") as fh :
60- fh.write(f"testing_ref={ref}\n")
61-
62- print(f"Using testing SDK branch : {ref}")
63- PYTHON
64- env :
65- PR_BODY : ${{ github.event.pull_request.body }}
6620 - name : Checkout Language SDK (this PR)
6721 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6822 with :
11064 if : github.event_name == 'pull_request'
11165 env :
11266 AWS_REGION : us-west-2
113-
67+
11468 steps :
11569 - name : Checkout Language SDK (this PR)
11670 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -173,20 +127,20 @@ jobs:
173127 run : |
174128 echo "Building examples..."
175129 hatch run examples:build
176-
130+
177131 # Get first integration example for testing
178132 EXAMPLE_NAME=$(echo '${{ steps.get-examples.outputs.examples }}' | jq -r '.[0].name')
179133 EXAMPLE_NAME_CLEAN=$(echo "$EXAMPLE_NAME" | sed 's/ //g')
180134 FUNCTION_NAME="${EXAMPLE_NAME_CLEAN}-LanguageSDK-PR-${{ github.event.number }}"
181-
135+
182136 echo "Deploying example: $EXAMPLE_NAME as $FUNCTION_NAME"
183137 hatch run examples:deploy "$EXAMPLE_NAME" --function-name "$FUNCTION_NAME"
184-
138+
185139 QUALIFIED_FUNCTION_NAME="$FUNCTION_NAME:\$LATEST"
186-
140+
187141 echo "Waiting for function to be ready..."
188142 aws lambda wait function-active --function-name "$FUNCTION_NAME" --endpoint-url "$LAMBDA_ENDPOINT" --region "${{ env.AWS_REGION }}"
189-
143+
190144 echo "Invoking Lambda function: $QUALIFIED_FUNCTION_NAME"
191145 aws lambda invoke \
192146 --function-name "$QUALIFIED_FUNCTION_NAME" \
@@ -196,18 +150,18 @@ jobs:
196150 --endpoint-url "$LAMBDA_ENDPOINT" \
197151 /tmp/response.json \
198152 > /tmp/invoke_response.json
199-
153+
200154 echo "Response:"
201155 cat /tmp/response.json
202-
156+
203157 # Check for function errors
204158 FUNCTION_ERROR=$(jq -r '.FunctionError // empty' /tmp/invoke_response.json)
205159 if [ -n "$FUNCTION_ERROR" ]; then
206160 echo "ERROR: Lambda function failed with error: $FUNCTION_ERROR"
207161 cat /tmp/response.json
208162 exit 1
209163 fi
210-
164+
211165 echo "Getting durable executions..."
212166 aws lambda list-durable-executions-by-function \
213167 --function-name "$QUALIFIED_FUNCTION_NAME" \
@@ -216,15 +170,13 @@ jobs:
216170 --endpoint-url "$LAMBDA_ENDPOINT" \
217171 --cli-binary-format raw-in-base64-out \
218172 > /tmp/executions.json
219-
173+
220174 echo "Durable Executions:"
221175 cat /tmp/executions.json
222-
176+
223177 # Cleanup
224178 echo "Cleaning up function: $FUNCTION_NAME"
225179 aws lambda delete-function \
226180 --function-name "$FUNCTION_NAME" \
227181 --endpoint-url "$LAMBDA_ENDPOINT" \
228182 --region "${{ env.AWS_REGION }}" || echo "Function cleanup failed or already deleted"
229-
230-
0 commit comments