Skip to content

feat(Go): Add DynamoDBEncryption Module #1719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 19, 2025
141 changes: 141 additions & 0 deletions .github/workflows/ci_test_go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# This workflow performs tests in Go.
name: Library Go tests

on:
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
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testGo:
strategy:
matrix:
library: [DynamoDbEncryption, TestVectors]
os: [ubuntu-22.04]
go-version: ["1.23"]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- name: Setup Docker
if: matrix.os == 'macos-13' && matrix.library == 'TestVectors'
uses: douglascamata/setup-docker-macos-action@v1-alpha

- name: Setup DynamoDB Local
if: matrix.library == 'TestVectors'
uses: rrainn/[email protected]
with:
port: 8000
cors: "*"

- name: Support longpaths
run: |
git config --global core.longpaths true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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@v3
with:
submodules: recursive

- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
dafny-version: ${{ inputs.dafny }}

- name: Create temporary global.json
run: echo '{"sdk":{"rollForward":"latestFeature","version":"6.0.0"}}' > ./global.json

- name: Setup Java 17 for codegen
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: "17"

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD

- name: Update project.properties if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
run: |
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Install Go imports
run: |
go install golang.org/x/tools/cmd/goimports@latest

- uses: actions/checkout@v3
- name: Init Submodules
shell: bash
run: |
git submodule update --init --recursive submodules/smithy-dafny
git submodule update --init --recursive submodules/MaterialProviders

- name: Install Smithy-Dafny codegen dependencies
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies

- name: Build ${{ matrix.library }} implementation
shell: bash
working-directory: ./${{ matrix.library }}
run: |
# This works because `node` is installed by default on GHA runners
CORES=$(node -e 'console.log(os.cpus().length)')
make transpile_go CORES=$CORES

- name: Regenerate code using smithy-dafny
shell: bash
working-directory: ./${{ matrix.library }}
run: |
make polymorph_go

- name: Copy ${{ matrix.library }} Vector Files
if: ${{ matrix.library == 'TestVectors' }}
shell: bash
working-directory: ./${{ matrix.library }}
run: |
cp runtimes/java/*.json runtimes/go/TestsFromDafny-go/

- name: Test ${{ matrix.library }}
working-directory: ./${{ matrix.library }}
run: |
make test_go

- name: Test Examples
if: matrix.library == 'DynamoDbEncryption'
working-directory: ./Examples/runtimes/go
run: |
go run main.go
2 changes: 1 addition & 1 deletion .github/workflows/ci_todos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
GOOD_TODO_COUNT=$( { grep -r "TODO.*\(github.com\/.*issues.*\/[1-9][0-9]*\|CrypTool-[1-9][0-9]*\)" . --exclude-dir=./releases --exclude-dir=./submodules --exclude-dir=./.git --exclude-dir=./TestVectors/runtimes --exclude=./.github/workflows/ci_todos.yml || true; } | wc -l)
if [ "$ALL_TODO_COUNT" != "$GOOD_TODO_COUNT" ]; then
exit 1;
fi
fi
154 changes: 80 additions & 74 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This workflow runs for every pull request
# TODO: CI for Go
name: PR CI

on:
Expand All @@ -9,80 +10,85 @@ jobs:
uses: ./.github/workflows/dafny_version.yml
getVerifyVersion:
uses: ./.github/workflows/dafny_verify_version.yml
pr-ci-format:
# pr-ci-format:
# needs: getVersion
# uses: ./.github/workflows/library_format.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-codegen:
# needs: getVersion
# uses: ./.github/workflows/ci_codegen.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-verification:
# needs: getVerifyVersion
# uses: ./.github/workflows/library_dafny_verification.yml
# with:
# dafny: ${{needs.getVerifyVersion.outputs.version}}
# pr-ci-test-vector-verification:
# needs: getVerifyVersion
# uses: ./.github/workflows/test_vector_verification.yml
# with:
# dafny: ${{needs.getVerifyVersion.outputs.version}}
# pr-ci-java:
# needs: getVersion
# uses: ./.github/workflows/ci_test_java.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-java-test-vectors:
# needs: getVersion
# uses: ./.github/workflows/ci_test_vector_java.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-java-examples:
# needs: getVersion
# uses: ./.github/workflows/ci_examples_java.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-net:
# needs: getVersion
# uses: ./.github/workflows/ci_test_net.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-rust:
# needs: getVersion
# uses: ./.github/workflows/library_rust_tests.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
pr-ci-go:
needs: getVersion
uses: ./.github/workflows/library_format.yml
uses: ./.github/workflows/ci_test_go.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-codegen:
needs: getVersion
uses: ./.github/workflows/ci_codegen.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-verification:
needs: getVerifyVersion
uses: ./.github/workflows/library_dafny_verification.yml
with:
dafny: ${{needs.getVerifyVersion.outputs.version}}
pr-ci-test-vector-verification:
needs: getVerifyVersion
uses: ./.github/workflows/test_vector_verification.yml
with:
dafny: ${{needs.getVerifyVersion.outputs.version}}
pr-ci-java:
needs: getVersion
uses: ./.github/workflows/ci_test_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-java-test-vectors:
needs: getVersion
uses: ./.github/workflows/ci_test_vector_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-java-examples:
needs: getVersion
uses: ./.github/workflows/ci_examples_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-net:
needs: getVersion
uses: ./.github/workflows/ci_test_net.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-rust:
needs: getVersion
uses: ./.github/workflows/library_rust_tests.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-net-test-vectors:
needs: getVersion
uses: ./.github/workflows/ci_test_vector_net.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-net-examples:
needs: getVersion
uses: ./.github/workflows/ci_examples_net.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-all-required:
if: always()
needs:
- getVersion
- getVerifyVersion
- pr-ci-format
- pr-ci-codegen
- pr-ci-verification
- pr-ci-test-vector-verification
- pr-ci-java
- pr-ci-java-test-vectors
- pr-ci-java-examples
- pr-ci-net
- pr-ci-rust
- pr-ci-net-test-vectors
- pr-ci-net-examples
runs-on: ubuntu-22.04
steps:
- name: Verify all required jobs passed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
# pr-ci-net-test-vectors:
# needs: getVersion
# uses: ./.github/workflows/ci_test_vector_net.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-net-examples:
# needs: getVersion
# uses: ./.github/workflows/ci_examples_net.yml
# with:
# dafny: ${{needs.getVersion.outputs.version}}
# pr-ci-all-required:
# if: always()
# needs:
# - getVersion
# - getVerifyVersion
# - pr-ci-format
# - pr-ci-codegen
# - pr-ci-verification
# - pr-ci-test-vector-verification
# - pr-ci-java
# - pr-ci-java-test-vectors
# - pr-ci-java-examples
# - pr-ci-net
# - pr-ci-rust
# - pr-ci-net-test-vectors
# - pr-ci-net-examples
# runs-on: ubuntu-22.04
# steps:
# - name: Verify all required jobs passed
# uses: re-actors/alls-green@release/v1
# with:
# jobs: ${{ toJSON(needs) }}
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This workflow runs for every push to main
# TODO: CI for Go
name: Push CI

on:
Expand Down
Loading
Loading