Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/ci_test_latest_released_mpl_java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# 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

- 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: ./.github/actions/install_smithy_dafny_codegen_dependencies

- 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command requires latest MPL.

In v3.x-java, latest MPL is coming from #2245


# 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
16 changes: 16 additions & 0 deletions .github/workflows/daily_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ jobs:
with:
dafny: ${{needs.getVersion.outputs.version}}
branch: ${{ matrix.branch }}
daily-test-with-released-mpl:
permissions:
id-token: write
contents: read
needs: getVersion
strategy:
matrix:
branch: [main, v3.x-Java]
uses: ./.github/workflows/ci_test_latest_released_mpl_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
branch: ${{ matrix.branch }}
run_test_vectors: true
strip_snapshot: true

notify:
permissions:
contents: read
Expand All @@ -202,6 +217,7 @@ jobs:
daily-ci-rust,
daily-ci-net-test-vectors,
daily-ci-net-examples,
daily-test-with-released-mpl,
]
if: ${{ failure() && github.event_name == 'schedule'}}
uses: aws/aws-cryptographic-material-providers-library/.github/workflows/slack-notification.yml@main
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/mpl_dependency_java_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ name: MPL Dependency Java Version

on:
workflow_call:
inputs:
strip_snapshot:
description: "Strip -SNAPSHOT suffix from version"
required: false
default: false
type: boolean
outputs:
version:
description: "The MPL Dependency Java version from project.properties"
Expand All @@ -14,11 +20,10 @@ jobs:
getMplDependencyJavaVersion:
permissions:
contents: read
pull-requests: write
id-token: write
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.read_property.outputs.mplDependencyJavaVersion }}
version: ${{ steps.resolve_version.outputs.version }}
steps:
- uses: actions/checkout@v6
- name: Read version from Properties-file
Expand All @@ -27,3 +32,14 @@ jobs:
with:
path: "./project.properties"
properties: "mplDependencyJavaVersion"
- name: Resolve version
id: resolve_version
env:
RAW_VERSION: ${{ steps.read_property.outputs.mplDependencyJavaVersion }}
STRIP: ${{ inputs.strip_snapshot }}
run: |
VERSION="$RAW_VERSION"
if [ "$STRIP" == "true" ]; then
VERSION="${VERSION%-SNAPSHOT}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
2 changes: 1 addition & 1 deletion project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projectJavaVersion=3.9.1-SNAPSHOT
mplDependencyJavaVersion=1.11.2-SNAPSHOT
mplDependencyJavaVersion=1.11.1-SNAPSHOT
mplDependencyNetVersion=2.0.0
dafnyVersion=4.9.0
dafnyVerifyVersion=4.9.1
Expand Down
2 changes: 1 addition & 1 deletion submodules/MaterialProviders
Loading