|
| 1 | +version: 0.2 |
| 2 | + |
| 3 | +phases: |
| 4 | + install: |
| 5 | + runtime-versions: |
| 6 | + dotnet: 6.0 |
| 7 | + python: 3.x |
| 8 | + commands: |
| 9 | + - cd .. |
| 10 | + # Get Dafny |
| 11 | + #- export `cat ./aws-database-encryption-sdk-dynamodb/project.properties` |
| 12 | + - curl https://github.com/dafny-lang/dafny/releases/download/v$dafnyVersion/dafny-$dafnyVersion-x64-ubuntu-20.04.zip -L -o dafny.zip |
| 13 | + - unzip -qq dafny.zip && rm dafny.zip |
| 14 | + - export PATH="$PWD/dafny:$PATH" |
| 15 | + # Switch back to the main directory |
| 16 | + - cd aws-database-encryption-sdk-dynamodb |
| 17 | + pre_build: |
| 18 | + commands: |
| 19 | + # UNIQUE_ID should be passed in as an environment variable. It is used to tie |
| 20 | + # the different parts of the asynchronous signing process together |
| 21 | + - echo "Using unique id for flow $UNIQUE_ID" |
| 22 | + # Build unsigned source |
| 23 | + - cd DynamoDbEncryption |
| 24 | + - make transpile_net |
| 25 | + - dotnet build runtimes/net /p:Configuration=Release -nowarn:CS0162,CS0168 |
| 26 | + # This step assumes signing has already happened and we just need to retrieve |
| 27 | + # the signed artifacts |
| 28 | + - export ASSEMBLY_NAME="AWS.Cryptography.DbEncryptionSDK.DynamoDb.dll" |
| 29 | + - export BASE=../codebuild/net |
| 30 | + - python $BASE/retrieve_signed_assembly.py --target net6.0 --unique-id $UNIQUE_ID |
| 31 | + - python $BASE/retrieve_signed_assembly.py --target net48 --unique-id $UNIQUE_ID |
| 32 | + build: |
| 33 | + commands: |
| 34 | + - mkdir build |
| 35 | + - >- |
| 36 | + aws codeartifact login \ |
| 37 | + --tool dotnet \ |
| 38 | + --repository dbesdk-net-staging \ |
| 39 | + --domain crypto-tools-internal \ |
| 40 | + --domain-owner 587316601012 \ |
| 41 | + --region us-east-1 |
| 42 | + # Set a unique version for releasing to staging, because this may fail and we don't |
| 43 | + # want to collide with previous runs |
| 44 | + - export VERSION=`grep '<Version>' runtimes/net/DynamoDbEncryption.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/'` |
| 45 | + - dotnet pack runtimes/net/DynamoDbEncryption.csproj --no-build /p:Configuration=Release --output build |
| 46 | + - dotnet nuget push build/AWS.Cryptography.DbEncryptionSDK.DynamoDb.$VERSION.nupkg --source crypto-tools-internal/dbesdk-net-staging |
| 47 | + # Now validate we can run the tests |
| 48 | + - sed -i.backup "/\<ProjectReference Include=\"..\/DynamoDbEncryption.csproj\" \/>/d" runtimes/net/tests/Test-DynamoDbEncryption.csproj |
| 49 | + - dotnet add runtimes/net/tests/Test-DynamoDbEncryption.csproj package AWS.Cryptography.DbEncryptionSDK.DynamoDb --version $VERSION |
| 50 | + |
| 51 | + # run tests |
| 52 | + - TMP_ROLE=$(aws sts assume-role --role-arn "arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2" --role-session-name "CB-TestVectorResources") |
| 53 | + - export TMP_ROLE |
| 54 | + - export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId') |
| 55 | + - export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey') |
| 56 | + - export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken') |
| 57 | + - aws sts get-caller-identity |
| 58 | + - make test_net FRAMEWORK=net6.0 |
| 59 | + |
| 60 | + # run test vectors |
| 61 | + - cd ../TestVectors |
| 62 | + - sed -i.backup "/\<ProjectReference Include=\"..\/..\/..\/DynamoDbEncryption\/runtimes\/net\/DynamoDbEncryption.csproj\" \/>/d" runtimes/net/DbEsdkTestVectors.csproj |
| 63 | + - dotnet add runtimes/net/DbEsdkTestVectors.csproj package AWS.Cryptography.DbEncryptionSDK.DynamoDb --version $VERSION |
| 64 | + - make transpile_net |
| 65 | + - cd runtimes/net |
| 66 | + - cp ../java/decrypt_java.json ../java/decrypt_dotnet.json . |
| 67 | + - dotnet run --framework net6.0 |
0 commit comments