@@ -15,102 +15,57 @@ env:
1515
1616phases :
1717 install :
18+ commands :
19+ - pip install "tox < 4.0" poetry
20+ - pip install --upgrade pip
1821 runtime-versions :
19- python : 3.11
22+ python : latest
23+ dotnet : 6.0
24+ pre_build :
2025 commands :
21- # Check VERSION is available from either environment or env.variables
22- - |
23- if [ -z "$VERSION" ]; then
24- echo "Using default VERSION=$VERSION"
25- else
26- echo "Using provided VERSION=$VERSION"
27- fi
28- # Install the released package instead of the source
26+ # Setup environment
27+ - aws configure set region us-west-2
28+ - git clone https://github.com/aws/aws-encryption-sdk.git esdk-dafny
29+ - cd esdk-dafny && git submodule update --init --recursive && cd ..
30+ # Install packages and setup environments
2931 - echo "Installing aws-encryption-sdk version $VERSION"
3032 - pip install "aws-encryption-sdk==$VERSION"
31- - pip install "tox < 4.0"
33+ - pyenv install --skip-existing 3.11.0 && pyenv local 3.11.0
34+ - make -C esdk-dafny/mpl/StandardLibrary setup_net
35+ - pip install pytest boto3 attrs cryptography
36+ # Update the aws-encryption-sdk version in TestVectors
37+ - sed -i "s/aws-encryption-sdk = \">=4.0.1\"/aws-encryption-sdk = \"==$VERSION\"/" \
38+ esdk-dafny/TestVectors/runtimes/python/pyproject.toml
3239 build :
3340 commands :
34- # Create a simple tox.ini file for running examples with the installed package
35- - |
36- cat > release_validation_tox.ini << 'EOF'
37- [tox]
38- envlist = py311
39- skipsdist = True
40-
41- [testenv]
42- passenv =
43- AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID
44- AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2
45- AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1
46- AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2
47- AWS_ACCESS_KEY_ID
48- AWS_SECRET_ACCESS_KEY
49- AWS_SESSION_TOKEN
50- AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
51- AWS_PROFILE
52- deps =
53- pytest
54- pytest-mock
55- mock
56- coverage
57- pyyaml
58- moto
59- boto3
60- cryptography
61- commands =
62- # Run non-MPL examples
63- pytest examples/test/legacy/ -m examples
64- # Run all other examples
65- pytest examples/test/ -m examples --ignore examples/test/legacy/
66- EOF
67-
68- # Run the examples with NUM_RETRIES to handle transient failures
69- - NUM_RETRIES=3
70- - |
71- while [ $NUM_RETRIES -gt 0 ]
72- do
73- tox -c release_validation_tox.ini -e py311
74- if [ $? -eq 0 ]; then
75- break
76- fi
77- NUM_RETRIES=$((NUM_RETRIES-1))
78- if [ $NUM_RETRIES -eq 0 ]; then
79- echo "All validation attempts failed, stopping"
80- exit 1;
81- else
82- echo "Validation failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
83- fi
84- done
85-
86- # Assume special role for MPL-specific tests
87- - echo "Running tests with special role for MPL features"
88- - TMP_ROLE=$(aws sts assume-role --role-arn "arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Python-Role-us-west-2" --role-session-name "CB-ValidateReleased")
89- - export TMP_ROLE
90- - export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
91- - export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
92- - export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
93- - aws sts get-caller-identity
94-
95- # Also install MPL requirements
96- - pip install -r requirements_mpl.txt
97-
98- # Run MPL-specific examples
9941 - NUM_RETRIES=3
10042 - |
43+ run_command() {
44+ eval "$1"
45+ return $?
46+ }
47+
48+ # Navigate to TestVectors directory
49+ cd esdk-dafny/TestVectors || exit 1
50+
10151 while [ $NUM_RETRIES -gt 0 ]
10252 do
103- # Only run the MPL-specific tests that require special permissions
104- # These would normally be run with py311-mplexamples-mpl
105- python -m pytest examples/test/ -m examples --ignore examples/test/legacy/
106- if [ $? -eq 0 ]; then
107- break
53+
54+ # Build TestVectors implementation in Python
55+ CORES=$(nproc || echo 4)
56+ if ! run_command "make transpile_python CORES=$CORES"; then
57+ NUM_RETRIES=$((NUM_RETRIES-1))
58+ [ $NUM_RETRIES -gt 0 ] && sleep 60 && continue
59+ exit 1
10860 fi
109- NUM_RETRIES=$((NUM_RETRIES-1))
110- if [ $NUM_RETRIES -eq 0 ]; then
111- echo "All MPL validation attempts failed, stopping"
112- exit 1;
113- else
114- echo "MPL validation failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
61+
62+ # Run all the test vector commands together
63+ if ! run_command "make test_generate_vectors_python && make test_encrypt_vectors_python && make test_decrypt_encrypt_vectors_python"; then
64+ NUM_RETRIES=$((NUM_RETRIES-1))
65+ [ $NUM_RETRIES -gt 0 ] && sleep 60 && continue
66+ exit 1
11567 fi
68+
69+ # Success
70+ break
11671 done
0 commit comments