-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathci_test_latest_released_mpl_java.yml
More file actions
177 lines (162 loc) · 7.04 KB
/
Copy pathci_test_latest_released_mpl_java.yml
File metadata and controls
177 lines (162 loc) · 7.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# This workflow is for testing that the latest released version
# of the MPL is compatible with the current DB-ESDK Head
name: Test Latest Released MPL Java with DB-ESDK HEAD
on:
workflow_dispatch:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean
branch:
description: "Branch to checkout"
required: true
type: string
run_test_vectors:
description: "Run Test Vectors?"
required: false
default: true
type: boolean
strip_snapshot:
description: "Strip -SNAPSHOT suffix from mpl Dependency in project properties?"
required: false
default: false
type: boolean
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean
branch:
description: "Branch to checkout"
required: true
type: string
run_test_vectors:
description: "Run Test Vectors?"
required: false
default: true
type: boolean
strip_snapshot:
description: "Strip -SNAPSHOT suffix from mpl Dependency in project properties?"
required: false
default: false
type: boolean
permissions:
id-token: write
contents: read
jobs:
getMplDependencyJavaVersion:
if: github.repository_owner == 'aws'
uses: ./.github/workflows/mpl_dependency_java_version.yml
with:
strip_snapshot: ${{ inputs.strip_snapshot == true }}
testJava:
needs: [getMplDependencyJavaVersion]
strategy:
matrix:
java-version: [17]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
role-session-name: DDBEC-Dafny-Java-Tests
special-characters-workaround: "true" # Some environments (example: windowsOS) cannot tolerate special characters in a secret key.
- uses: actions/checkout@v6
with:
ref: ${{ inputs.branch }}
submodules: recursive
- name: Setup Java ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
distribution: "corretto"
java-version: ${{ matrix.java-version }}
- name: Setup Dafny
uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/
with:
dafny-version: ${{ inputs.dafny }}
- name: Install Smithy-Dafny codegen dependencies
uses: ./submodules/MaterialProviders/.github/actions/install_smithy_dafny_codegen_dependencies
with:
mpl-submodule-path: ./submodules/MaterialProviders/
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ inputs.dafny }}
library: DynamoDbEncryption
diff-generated-code: false
update-and-regenerate-mpl: true
- name: Override MPL dependency version
run: |
sed -i "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{ needs.getMplDependencyJavaVersion.outputs.version }}/" project.properties
# The following two steps: "Build and deploy to maven local" and "Run Extensive Tests"
# mimic the tests in ./codebuild/staging/release-staging.yml
- name: Build and deploy to maven local
shell: bash
working-directory: ./DynamoDbEncryption
run: |
# Run transpile by itself. We don't want to locally build the MPL because
# we want to verify that the version pulled down from maven works correctly
make transpile_implementation_java
make transpile_test_java
make mvn_local_deploy
make test_java
- name: Run Extensive Tests
working-directory: ./DynamoDbEncryption
run: |
gradle -p runtimes/java clean
gradle -p runtimes/java test
- name: Update project.properties to use the correct MPL version (from project.properties in DB-ESDK)
working-directory: ./submodules/MaterialProviders/
run: |
sed "s/javaMPLVersion=.*/javaMPLVersion=${{needs.getMplDependencyJavaVersion.outputs.version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
# The following three steps: "Transpile MPL Test Vectors without recursively building the MPL",
# "Run Test Vectors", and "Test Examples" mimic the tests in ./codebuild/staging/validate-staging.yml
- name: Transpile MPL Test Vectors without recursively building the MPL
working-directory: ./submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders
run: |
# Run transpile by itself. We don't want to locally build the MPL because
# we want to verify that the version pulled down from maven works correctly
make transpile_implementation_java
make transpile_test_java
make mvn_local_deploy
- name: Run Test Vectors
if: inputs.run_test_vectors
working-directory: ./TestVectors
run: |
# Spin up ddb local
docker run --name dynamodb -d -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -port 8000 -inMemory -cors *
# Run transpile by itself so we don't locally build the MPL.
make transpile_implementation_java
make transpile_test_java
gradle -p runtimes/java runTests
- name: Test Examples
working-directory: ./Examples
run: |
gradle -p runtimes/java/DynamoDbEncryption test
if [[ "${{ inputs.branch }}" == "v3.x-Java" ]]; then
gradle -p runtimes/java/Migration/PlaintextToAWSDBE test
gradle -p runtimes/java/Migration/DDBECToAWSDBE test
else
gradle -p runtimes/java/DDBECwithSDKV2 test
gradle -p runtimes/java/Migration/PlaintextToAWSDBE test
gradle -p runtimes/java/Migration/DDBECv2ToAWSDBE test
fi