@@ -15,102 +15,57 @@ env:
15
15
16
16
phases :
17
17
install :
18
+ commands :
19
+ - pip install "tox < 4.0" poetry
20
+ - pip install --upgrade pip
18
21
runtime-versions :
19
- python : 3.11
22
+ python : latest
23
+ dotnet : 6.0
24
+ pre_build :
20
25
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
29
31
- echo "Installing aws-encryption-sdk version $VERSION"
30
32
- 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
32
39
build :
33
40
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
99
41
- NUM_RETRIES=3
100
42
- |
43
+ run_command() {
44
+ eval "$1"
45
+ return $?
46
+ }
47
+
48
+ # Navigate to TestVectors directory
49
+ cd esdk-dafny/TestVectors || exit 1
50
+
101
51
while [ $NUM_RETRIES -gt 0 ]
102
52
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
108
60
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
115
67
fi
68
+
69
+ # Success
70
+ break
116
71
done
0 commit comments