Skip to content

Commit 4faf9ed

Browse files
authored
chore: add .NET release steps (#717)
* chore: add .NET release steps * add ubuntu and windows
1 parent 15adbab commit 4faf9ed

18 files changed

+302
-22
lines changed

Diff for: .github/workflows/ci_test_net.yml

+19-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
dotnet-version: [ '6.0.x' ]
3737
os: [
3838
macos-latest,
39+
ubuntu-latest,
40+
windows-latest
3941
]
4042
runs-on: ${{ matrix.os }}
4143
permissions:
@@ -45,6 +47,9 @@ jobs:
4547
DOTNET_CLI_TELEMETRY_OPTOUT: 1
4648
DOTNET_NOLOGO: 1
4749
steps:
50+
- name: Support longpaths on Git checkout
51+
run: |
52+
git config --global core.longpaths true
4853
- uses: actions/checkout@v3
4954
with:
5055
submodules: recursive
@@ -78,12 +83,24 @@ jobs:
7883
# This works because `node` is installed by default on GHA runners
7984
CORES=$(node -e 'console.log(os.cpus().length)')
8085
make transpile_net CORES=$CORES
81-
- name: Test ${{ matrix.library }}
86+
87+
- name: Test ${{ matrix.library }} net48
88+
if: matrix.os == 'windows-latest'
89+
working-directory: ./${{ matrix.library }}
90+
shell: bash
91+
run: |
92+
dotnet restore runtimes/net/tests
93+
dotnet build runtimes/net/tests
94+
make test_net FRAMEWORK=net48
95+
96+
- name: Test ${{ matrix.library }} net6.0
8297
working-directory: ./${{ matrix.library }}
8398
shell: bash
8499
run: |
100+
dotnet restore runtimes/net/tests
101+
dotnet build runtimes/net/tests
85102
if [ "$RUNNER_OS" == "macOS" ]; then
86103
make test_net_mac_intel
87104
else
88-
make test_net
105+
make test_net FRAMEWORK=net6.0
89106
fi

Diff for: .github/workflows/ci_test_vector_net.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ jobs:
5555
# This works because `node` is installed by default on GHA runners
5656
make transpile_net
5757
58-
- name: Test TestVectors
58+
- name: Test TestVectors on .NET 6.0
5959
working-directory: ./TestVectors/runtimes/net
6060
run: |
6161
cp ../java/decrypt_java.json ../java/decrypt_dotnet.json .
6262
dotnet run
6363
cp ../java/*.json .
64-
dotnet run
64+
dotnet run --framework net6.0
65+

Diff for: DynamoDbEncryption/codebuild/release-prod.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
- export VERSION=`grep '<Version>' runtimes/net/DynamoDbEncryption.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/'`
36+
- dotnet pack runtimes/net/DynamoDbEncryption.csproj --no-build /p:Configuration=Release --output build
37+
- export API_ACCESS_KEY=$(python $BASE/retrieve_api_access_key.py)
38+
- dotnet nuget push build/AWS.Cryptography.DbEncryptionSDK.DynamoDb.$VERSION.nupkg --api-key "$API_ACCESS_KEY" --source https://api.nuget.org/v3/index.json

Diff for: DynamoDbEncryption/codebuild/release-staging.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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

Diff for: DynamoDbEncryption/codebuild/release.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 0.2
2+
3+
batch:
4+
fast-fail: true
5+
build-graph:
6+
- identifier: sign
7+
buildspec: DynamoDbEncryption/codebuild/sign.yml
8+
env:
9+
type: LINUX_CONTAINER
10+
image: aws/codebuild/standard:6.0
11+
- identifier: verify
12+
buildspec: DynamoDbEncryption/codebuild/verify.yml
13+
env:
14+
type: WINDOWS_SERVER_2019_CONTAINER
15+
image: aws/codebuild/windows-base:2019-2.0
16+
depend-on:
17+
- sign
18+
- identifier: release_staging
19+
buildspec: DynamoDbEncryption/codebuild/release-staging.yml
20+
env:
21+
type: LINUX_CONTAINER
22+
image: aws/codebuild/standard:6.0
23+
depend-on:
24+
- verify
25+
- identifier: release_prod
26+
buildspec: DynamoDbEncryption/codebuild/release-prod.yml
27+
env:
28+
type: LINUX_CONTAINER
29+
image: aws/codebuild/standard:6.0
30+
depend-on:
31+
- verify
32+
- release_staging
33+
- identifier: test_prod
34+
buildspec: DynamoDbEncryption/codebuild/test-prod.yml
35+
env:
36+
type: LINUX_CONTAINER
37+
image: aws/codebuild/standard:6.0
38+
depend-on:
39+
- release_prod

Diff for: DynamoDbEncryption/codebuild/sign.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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:
23+
commands:
24+
## Build Library from Source
25+
- cd DynamoDbEncryption
26+
- make transpile_net
27+
- 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")
28+
- export TMP_ROLE
29+
- export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
30+
- export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
31+
- export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
32+
- aws sts get-caller-identity
33+
- make test_net FRAMEWORK=net6.0
34+
35+
## Unset temp creds so that we get dropped back into the aws codebuild service role
36+
- unset AWS_ACCESS_KEY_ID; unset AWS_SECRET_ACCESS_KEY; unset AWS_SESSION_TOKEN;
37+
38+
- dotnet build runtimes/net /p:Configuration=Release -nowarn:CS0162,CS0168
39+
- export ASSEMBLY_NAME="AWS.Cryptography.DbEncryptionSDK.DynamoDb.dll"
40+
- export BASE=../codebuild/net
41+
- python $BASE/upload_assembly.py --target net6.0 --unique-id $UNIQUE_ID
42+
- python $BASE/upload_assembly.py --target net48 --unique-id $UNIQUE_ID
43+
## Retrieve the signed assembly. We're not going to use it, but this
44+
## ensures that the signing process is complete
45+
- python $BASE/retrieve_signed_assembly.py --target net6.0 --unique-id $UNIQUE_ID
46+
- python $BASE/retrieve_signed_assembly.py --target net48 --unique-id $UNIQUE_ID

Diff for: DynamoDbEncryption/codebuild/test-prod.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
- cd DynamoDbEncryption
20+
- make transpile_net
21+
build:
22+
commands:
23+
- export VERSION=`grep '<Version>' runtimes/net/DynamoDbEncryption.csproj | sed 's/.*<Version>\(.*\)<\/Version>/\1/'`
24+
- sed -i.backup "/\<ProjectReference Include=\"..\/DynamoDbEncryption.csproj\" \/>/d" runtimes/net/tests/Test-DynamoDbEncryption.csproj
25+
- dotnet add runtimes/net/tests/Test-DynamoDbEncryption.csproj package AWS.Cryptography.DbEncryptionSDK.DynamoDb --version $VERSION
26+
27+
# run tests
28+
- 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")
29+
- export TMP_ROLE
30+
- export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
31+
- export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
32+
- export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
33+
- aws sts get-caller-identity
34+
- make test_net FRAMEWORK=net6.0
35+
36+
# run test vectors
37+
- cd ../TestVectors
38+
- sed -i.backup "/\<ProjectReference Include=\"..\/..\/..\/DynamoDbEncryption\/runtimes\/net\/DynamoDbEncryption.csproj\" \/>/d" runtimes/net/DbEsdkTestVectors.csproj
39+
- dotnet add runtimes/net/DbEsdkTestVectors.csproj package AWS.Cryptography.DbEncryptionSDK.DynamoDb --version $VERSION
40+
- make transpile_net
41+
- cd runtimes/net
42+
- cp ../java/decrypt_java.json ../java/decrypt_dotnet.json .
43+
- dotnet run --framework net6.0

Diff for: DynamoDbEncryption/codebuild/verify.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
FILE_NAME: "AWS.Cryptography.DbEncryptionSDK.DynamoDb.dll"
6+
ASSEMBLY_NAME: "AWS.Cryptography.DbEncryptionSDK.DynamoDb.dll"
7+
8+
phases:
9+
install:
10+
runtime-versions:
11+
dotnet: 6.0
12+
python: 3.x
13+
build:
14+
commands:
15+
- mkdir net48
16+
- python codebuild/net/retrieve_signed_assembly.py --target net48 --unique-id $Env:UNIQUE_ID --output net48
17+
- $sig = Get-AuthenticodeSignature -FilePath net48/$Env:FILE_NAME
18+
- $sig | Format-List -Property *
19+
# Check signature on net6.0 dll
20+
- mkdir net6.0
21+
- python codebuild/net/retrieve_signed_assembly.py --target net6.0 --unique-id $Env:UNIQUE_ID --output net6.0
22+
- $sig = Get-AuthenticodeSignature -FilePath net6.0/$Env:FILE_NAME
23+
- $sig | Format-List -Property *

Diff for: DynamoDbEncryption/runtimes/java/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ publishing {
138138
pom {
139139
name.set("AWS Database Encryption SDK for DynamoDB")
140140
description.set("AWS Database Encryption SDK for DynamoDB in Java")
141-
url.set("https://github.com/aws/aws-database-encryption-sdk-dynamodb-java")
141+
url.set("https://github.com/aws/aws-database-encryption-sdk-dynamodb")
142142
licenses {
143143
license {
144144
name.set("Apache License 2.0")
@@ -155,7 +155,7 @@ publishing {
155155
}
156156
}
157157
scm {
158-
url.set("https://github.com/aws/aws-database-encryption-sdk-dynamodb-java.git")
158+
url.set("https://github.com/aws/aws-database-encryption-sdk-dynamodb.git")
159159
}
160160
}
161161
}

Diff for: DynamoDbEncryption/runtimes/net/AssemblyInfo.cs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyTitle("AWS.Cryptography.DbEncryptionSDK.DynamoDb")]
4+
5+
// This should be kept in sync with the version number in MPL.csproj
6+
[assembly: AssemblyVersion("3.2.0")]
7+

Diff for: DynamoDbEncryption/runtimes/net/DynamoDbEncryption.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<ItemGroup>
3535
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.300.2"/>
3636
<PackageReference Include="AWSSDK.Core" Version="3.7.300.2"/>
37+
<PackageReference Include="DafnyRuntime" Version="4.2.0" />
3738
<ProjectReference Include="../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/runtimes/net/MPL.csproj"/>
3839
<!--
3940
System.Collections.Immutable can be removed once dafny.msbuild is updated with

Diff for: DynamoDbEncryption/runtimes/net/tests/Test-DynamoDbEncryption.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<RootNamespace>TEST_AWS Cryptography DynamoDb Encryption</RootNamespace>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>disable</Nullable>
7-
<TargetFrameworks>net6.0</TargetFrameworks>
7+
<TargetFrameworks>net6.0;net48</TargetFrameworks>
88
<LangVersion>10</LangVersion>
99
<OutputType>Exe</OutputType>
1010
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>

0 commit comments

Comments
 (0)