Skip to content

Commit 19ff8af

Browse files
Revert "chore: remove test against latest mpl version (#2008)"
This reverts commit 728158e.
1 parent 035dbe3 commit 19ff8af

1 file changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# This workflow is for testing that the latest released version
2+
# of the MPL is compatible with the current DB-ESDK Head
3+
name: Test Latest Released MPL Java with DB-ESDK HEAD
4+
5+
on:
6+
schedule:
7+
- cron: "00 16 * * 1-5"
8+
workflow_dispatch: # allows triggering this manually through the Actions UI
9+
inputs:
10+
run_test_vectors:
11+
description: "Run Test Vectors?"
12+
required: false
13+
default: true
14+
type: boolean
15+
16+
jobs:
17+
getVersion:
18+
# Don't run the cron builds on forks
19+
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
20+
uses: ./.github/workflows/dafny_version.yml
21+
getVerifyVersion:
22+
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
23+
uses: ./.github/workflows/dafny_verify_version.yml
24+
getMplDependencyJavaVersion:
25+
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
26+
uses: ./.github/workflows/mpl_dependency_java_version.yml
27+
testJava:
28+
needs: [getVersion, getMplDependencyJavaVersion]
29+
strategy:
30+
max-parallel: 1
31+
matrix:
32+
java-version: [17]
33+
os: [ubuntu-22.04]
34+
runs-on: ${{ matrix.os }}
35+
permissions:
36+
id-token: write
37+
contents: read
38+
steps:
39+
- name: Configure AWS Credentials
40+
uses: aws-actions/configure-aws-credentials@v5
41+
with:
42+
aws-region: us-west-2
43+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
44+
role-session-name: DDBEC-Dafny-Java-Tests
45+
46+
- uses: actions/checkout@v5
47+
with:
48+
submodules: recursive
49+
50+
- name: Setup Java ${{ matrix.java-version }}
51+
uses: actions/setup-java@v5
52+
with:
53+
distribution: "corretto"
54+
java-version: ${{ matrix.java-version }}
55+
56+
- name: Setup Dafny
57+
uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/
58+
with:
59+
dafny-version: ${{ needs.getVersion.outputs.version }}
60+
61+
- name: Install Smithy-Dafny codegen dependencies
62+
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
63+
64+
- name: Regenerate code using smithy-dafny if necessary
65+
if: ${{ inputs.regenerate-code }}
66+
uses: ./.github/actions/polymorph_codegen
67+
with:
68+
dafny: ${{ env.DAFNY_VERSION }}
69+
library: DynamoDbEncryption
70+
diff-generated-code: false
71+
update-and-regenerate-mpl: true
72+
73+
# The following two steps: "Build and deploy to maven local" and "Run Extensive Tests"
74+
# mimic the tests in ./codebuild/staging/release-staging.yml
75+
- name: Build and deploy to maven local
76+
shell: bash
77+
working-directory: ./DynamoDbEncryption
78+
run: |
79+
# Run transpile by itself. We don't want to locally build the MPL because
80+
# we want to verify that the version pulled down from maven works correctly
81+
make transpile_implementation_java
82+
make transpile_test_java
83+
make mvn_local_deploy
84+
make test_java
85+
86+
- name: Run Extensive Tests
87+
working-directory: ./DynamoDbEncryption
88+
run: |
89+
gradle -p runtimes/java clean
90+
gradle -p runtimes/java test
91+
92+
# This makes sure that we are using the correct MPL version to test the DB-ESDK.
93+
# If this contains a SNAPSHOT version, this will fail because'
94+
# we are NOT building the MPL recursively but pulling from Maven.
95+
- name: Update project.properties to use the correct MPL version (from project.properties in DB-ESDK)
96+
working-directory: ./submodules/MaterialProviders/
97+
run: |
98+
sed "s/mplVersion=.*/mplVersion=${{needs.getMplDependencyJavaVersion.outputs.version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
99+
100+
# The following three steps: "Transpile MPL Test Vectors without recursively building the MPL",
101+
# "Run Test Vectors", and "Test Examples" mimic the tests in ./codebuild/staging/validate-staging.yml
102+
- name: Transpile MPL Test Vectors without recursively building the MPL
103+
working-directory: ./submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders
104+
run: |
105+
# Run transpile by itself. We don't want to locally build the MPL because
106+
# we want to verify that the version pulled down from maven works correctly
107+
make transpile_implementation_java
108+
make transpile_test_java
109+
make mvn_local_deploy
110+
111+
- name: Run Test Vectors
112+
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && ${{inputs.run_test_vectors}})
113+
working-directory: ./TestVectors
114+
run: |
115+
# Spin up ddb local
116+
docker run --name dynamodb -d -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -port 8000 -inMemory -cors *
117+
# Run transpile by itself so we don't locally build the MPL.
118+
make transpile_implementation_java
119+
make transpile_test_java
120+
gradle -p runtimes/java runTests
121+
122+
- name: Test Examples
123+
working-directory: ./Examples
124+
run: |
125+
# Run Simple Examples
126+
gradle -p runtimes/java/DynamoDbEncryption test
127+
# Run Migration Examples
128+
gradle -p runtimes/java/Migration/PlaintextToAWSDBE test
129+
gradle -p runtimes/java/Migration/DDBECToAWSDBE test

0 commit comments

Comments
 (0)