Skip to content

Commit 3d5bbdc

Browse files
authored
Merge branch 'main' into pr1/invoker-state-checkpoint-stamping
2 parents b839392 + c575f46 commit 3d5bbdc

15 files changed

Lines changed: 659 additions & 2171 deletions

.github/workflows/cloud-tests.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Cloud tests
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
inputs:
8+
lambda_endpoint:
9+
description: "Optional Lambda endpoint URL for deploying and running cloud tests"
10+
required: false
11+
type: string
12+
region:
13+
description: "AWS Region for deploying and running cloud tests"
14+
required: false
15+
default: us-west-2
16+
type: string
17+
18+
env:
19+
AWS_REGION: ${{ github.event.inputs.region || 'us-west-2' }}
20+
21+
permissions:
22+
id-token: write
23+
contents: read
24+
25+
jobs:
26+
example-tests:
27+
name: example-tests (${{ matrix.python-version }})
28+
runs-on: ubuntu-latest
29+
concurrency:
30+
group: cloud-tests-${{ matrix.python-prefix }}
31+
cancel-in-progress: false
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- python-version: "3.11"
37+
python-prefix: Py311
38+
- python-version: "3.12"
39+
python-prefix: Py312
40+
- python-version: "3.13"
41+
python-prefix: Py313
42+
- python-version: "3.14"
43+
python-prefix: Py314
44+
steps:
45+
- uses: actions/checkout@v7
46+
47+
- name: Setup Python
48+
uses: actions/setup-python@v6
49+
with:
50+
python-version: ${{ matrix.python-version }}
51+
52+
- name: Configure AWS credentials
53+
if: github.event_name != 'workflow_dispatch' || github.actor != 'nektos/act'
54+
uses: aws-actions/configure-aws-credentials@v6
55+
with:
56+
role-to-assume: "${{ secrets.TEST_ROLE_ARN }}"
57+
role-session-name: pythonTestingLibraryGitHubIntegrationTest
58+
aws-region: ${{ env.AWS_REGION }}
59+
60+
- name: Verify AWS test account
61+
if: github.event_name != 'workflow_dispatch' || github.actor != 'nektos/act'
62+
env:
63+
TEST_ACCOUNT_ID: ${{ secrets.TEST_ACCOUNT_ID }}
64+
run: |
65+
ACTUAL_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
66+
if [ "$ACTUAL_ACCOUNT_ID" != "$TEST_ACCOUNT_ID" ]; then
67+
echo "Expected AWS account $TEST_ACCOUNT_ID but assumed into $ACTUAL_ACCOUNT_ID"
68+
exit 1
69+
fi
70+
echo "Using AWS test account $ACTUAL_ACCOUNT_ID"
71+
72+
- name: Install Hatch
73+
run: pip install hatch
74+
75+
- name: Setup SAM CLI
76+
uses: aws-actions/setup-sam@v3
77+
78+
- name: Build examples
79+
run: |
80+
hatch run -- examples:pip install -e packages/aws-durable-execution-sdk-python packages/aws-durable-execution-sdk-python-otel packages/aws-durable-execution-sdk-python-testing
81+
hatch run examples:build
82+
hatch run examples:generate-sam-template
83+
84+
- name: Deploy all examples with SAM
85+
id: deploy
86+
env:
87+
LAMBDA_EXECUTION_ROLE_ARN: ${{ secrets.TEST_LAMBDA_EXECUTION_ROLE_ARN }}
88+
LAMBDA_ENDPOINT_OVERRIDE: ${{ github.event.inputs.lambda_endpoint || vars.TEST_LAMBDA_ENDPOINT }}
89+
PYTHON_RUNTIME: python${{ matrix.python-version }}
90+
STACK_NAME: ${{ matrix.python-prefix }}-python-examples
91+
FUNCTION_NAME_PREFIX: ${{ matrix.python-prefix }}-
92+
run: |
93+
echo "Building SAM application"
94+
sam build --template-file packages/aws-durable-execution-sdk-python-examples/template.generated.json
95+
96+
PARAMETER_OVERRIDES=(
97+
PythonRuntime="$PYTHON_RUNTIME"
98+
FunctionNamePrefix="$FUNCTION_NAME_PREFIX"
99+
LambdaExecutionRoleArn="$LAMBDA_EXECUTION_ROLE_ARN"
100+
)
101+
if [ -n "$LAMBDA_ENDPOINT_OVERRIDE" ]; then
102+
PARAMETER_OVERRIDES+=(LambdaEndpoint="$LAMBDA_ENDPOINT_OVERRIDE")
103+
echo "LAMBDA_ENDPOINT=$LAMBDA_ENDPOINT_OVERRIDE" >> $GITHUB_ENV
104+
echo "Using custom Lambda endpoint override"
105+
fi
106+
107+
echo "Deploying stack $STACK_NAME with function prefix $FUNCTION_NAME_PREFIX and runtime $PYTHON_RUNTIME"
108+
sam deploy \
109+
--template-file .aws-sam/build/template.yaml \
110+
--stack-name "$STACK_NAME" \
111+
--resolve-s3 \
112+
--no-confirm-changeset \
113+
--no-fail-on-empty-changeset \
114+
--region "$AWS_REGION" \
115+
--parameter-overrides "${PARAMETER_OVERRIDES[@]}"
116+
117+
PYTEST_FUNCTION_NAME_MAP=$(
118+
python packages/aws-durable-execution-sdk-python-examples/scripts/generate_function_name_map.py \
119+
--function-name-prefix "$FUNCTION_NAME_PREFIX"
120+
)
121+
122+
echo "PYTEST_FUNCTION_NAME_MAP=$PYTEST_FUNCTION_NAME_MAP" >> $GITHUB_ENV
123+
124+
- name: Run Integration Tests
125+
run: |
126+
echo "Running integration tests for all deployed examples"
127+
echo "AWS Region: ${AWS_REGION}"
128+
echo "Configured function map: ${PYTEST_FUNCTION_NAME_MAP}"
129+
130+
mkdir -p .test-results
131+
hatch run test:examples-integration -n 8 --dist loadfile --junitxml=.test-results/examples.xml
132+
133+
- name: Report Test Summary
134+
if: always()
135+
run: |
136+
python packages/aws-durable-execution-sdk-python-examples/scripts/write_junit_summary.py \
137+
.test-results/examples.xml \
138+
--title "Cloud test summary (Python ${{ matrix.python-version }})" \
139+
--output "$GITHUB_STEP_SUMMARY"

.github/workflows/deploy-examples.yml

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)