Skip to content

Commit d69d084

Browse files
Merge pull request #732 from aws/Golang/dev
feat: polymorph_go check-in
2 parents 735f08c + 0ba9ada commit d69d084

File tree

30 files changed

+2681
-13
lines changed

30 files changed

+2681
-13
lines changed

.github/workflows/daily_ci.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,24 @@ jobs:
3333
uses: ./.github/workflows/library_rust_tests.yml
3434
with:
3535
dafny: '4.9.0'
36+
daily-ci-go:
37+
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
38+
uses: ./.github/workflows/library_go_tests.yml
39+
with:
40+
dafny: '4.9.0'
3641

3742
daily-ci-interop-tests:
3843
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
3944
uses: ./.github/workflows/library_interop_tests.yml
4045
with:
4146
dafny: '4.9.0'
42-
47+
4348
daily-dafny-test-vectors:
4449
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
4550
uses: ./.github/workflows/library_interop_test_vectors.yml
4651
with:
4752
dafny: '4.9.0'
48-
53+
4954
daily-dafny-legacy-test-vectors:
5055
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
5156
uses: ./.github/workflows/library_legacy_interop_test_vectors.yml
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# This workflow performs tests in Go.
2+
name: Library Go tests
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
dafny:
8+
description: 'The Dafny version to run'
9+
required: true
10+
type: string
11+
regenerate-code:
12+
description: "Regenerate code using smithy-dafny"
13+
required: false
14+
default: false
15+
type: boolean
16+
17+
jobs:
18+
testGo:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
library: [AwsEncryptionSDK]
23+
go-version: [ "1.23" ]
24+
os: [
25+
# Sed script doesn't work properly on windows
26+
# windows-latest,
27+
ubuntu-latest,
28+
macos-13,
29+
]
30+
runs-on: ${{ matrix.os }}
31+
permissions:
32+
id-token: write
33+
contents: read
34+
steps:
35+
- name: Support longpaths on Git checkout
36+
run: |
37+
git config --global core.longpaths true
38+
- uses: actions/checkout@v3
39+
- name: Init Submodules
40+
shell: bash
41+
run: |
42+
git submodule update --init libraries
43+
git submodule update --init --recursive mpl
44+
45+
- name: Configure AWS Credentials
46+
uses: aws-actions/configure-aws-credentials@v2
47+
with:
48+
aws-region: us-west-2
49+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
50+
role-session-name: GoTests
51+
52+
- name: Setup Dafny
53+
uses: dafny-lang/[email protected]
54+
with:
55+
dafny-version: ${{ inputs.dafny }}
56+
57+
- name: Setup NASM for Windows (aws-lc-sys)
58+
if: matrix.os == 'windows-latest'
59+
uses: ilammy/setup-nasm@v1
60+
61+
- name: Install Go
62+
uses: actions/setup-go@v5
63+
with:
64+
go-version: ${{ matrix.go-version }}
65+
66+
- name: Install Go imports
67+
run: |
68+
go install golang.org/x/tools/cmd/goimports@latest
69+
70+
- name: Compile ${{ matrix.library }} implementation
71+
shell: bash
72+
working-directory: ${{ matrix.library }}
73+
run: |
74+
# This works because `node` is installed by default on GHA runners
75+
CORES=$(node -e 'console.log(os.cpus().length)')
76+
make transpile_go CORES=$CORES
77+
78+
- name: Test Go
79+
working-directory: ${{ matrix.library }}
80+
shell: bash
81+
run: |
82+
make test_go

.github/workflows/library_interop_test_vectors.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
uses: aws-actions/configure-aws-credentials@v2
4444
with:
4545
aws-region: us-west-2
46-
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
46+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
4747
role-session-name: InterOpTests
4848

4949
- uses: actions/checkout@v3
@@ -75,7 +75,7 @@ jobs:
7575
# TODO - uncomment this after Rust formatter works
7676
# - name: Rustfmt Check
7777
# uses: actions-rust-lang/rustfmt@v1
78-
78+
7979
# TODO: Remove this after the formatting in Rust starts working
8080
- name: smithy-dafny Rust hacks
8181
if: matrix.language == 'rust'
@@ -122,19 +122,19 @@ jobs:
122122
# This works because `node` is installed by default on GHA runners
123123
CORES=$(node -e 'console.log(os.cpus().length)')
124124
make transpile_net
125-
125+
126126
- name: Install Smithy-Dafny codegen dependencies
127127
if: matrix.language == 'rust'
128128
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
129-
129+
130130
# TODO: Remove this after checking in Rust polymorph code
131131
- name: Run make polymorph_rust
132132
if: matrix.language == 'rust'
133133
shell: bash
134134
working-directory: ./${{ matrix.library }}
135135
run: |
136136
make polymorph_rust
137-
137+
138138
- name: Build ${{ matrix.library }} implementation in Rust
139139
if: matrix.language == 'rust'
140140
shell: bash
@@ -279,7 +279,7 @@ jobs:
279279
- name: Install Smithy-Dafny codegen dependencies
280280
if: matrix.decrypting_language == 'rust'
281281
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
282-
282+
283283
# TODO: Remove this after checking in Rust polymorph code
284284
- name: Run make polymorph_rust
285285
if: matrix.decrypting_language == 'rust'

.github/workflows/manual.yml

+5
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ jobs:
3737
with:
3838
dafny: ${{ inputs.dafny }}
3939
regenerate-code: ${{ inputs.regenerate-code }}
40+
manual-ci-go:
41+
uses: ./.github/workflows/library_go_tests.yml
42+
with:
43+
dafny: ${{ inputs.dafny }}
44+
regenerate-code: ${{ inputs.regenerate-code }}

.github/workflows/nighly_dafny.yml

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ jobs:
3737
with:
3838
dafny: 'nightly-latest'
3939
regenerate-code: true
40+
dafny-nightly-go:
41+
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
42+
uses: ./.github/workflows/library_go_tests.yml
43+
with:
44+
dafny: 'nightly-latest'
45+
regenerate-code: true
4046

4147
cut-issue-on-failure:
4248
runs-on: ubuntu-latest

.github/workflows/pull.yml

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
uses: ./.github/workflows/library_rust_tests.yml
2626
with:
2727
dafny: '4.9.0'
28+
pr-ci-go:
29+
uses: ./.github/workflows/library_go_tests.yml
30+
with:
31+
dafny: '4.9.0'
2832
pr-test-vectors:
2933
uses: ./.github/workflows/library_interop_tests.yml
3034
with:

.github/workflows/push.yml

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
uses: ./.github/workflows/library_rust_tests.yml
2828
with:
2929
dafny: '4.9.0'
30+
push-ci-go:
31+
uses: ./.github/workflows/library_go_tests.yml
32+
with:
33+
dafny: '4.9.0'
3034
pr-test-vectors:
3135
uses: ./.github/workflows/library_interop_tests.yml
3236
with:

AwsEncryptionSDK/Makefile

+28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
CORES=2
4+
ENABLE_EXTERN_PROCESSING=1
45

56
TRANSPILE_TESTS_IN_RUST := 1
67

@@ -64,3 +65,30 @@ SERVICE_DEPS_AwsEncryptionSdk := \
6465
mpl/ComAmazonawsDynamodb \
6566
mpl/AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders \
6667
mpl/AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore
68+
69+
GO_MODULE_NAME="github.com/aws/aws-encryption-sdk"
70+
71+
GO_DEPENDENCY_MODULE_NAMES := \
72+
--dependency-library-name=com.amazonaws.dynamodb=github.com/aws/aws-cryptographic-material-providers-library/dynamodb \
73+
--dependency-library-name=com.amazonaws.kms=github.com/aws/aws-cryptographic-material-providers-library/kms \
74+
--dependency-library-name=aws.cryptography.keyStore=github.com/aws/aws-cryptographic-material-providers-library/mpl \
75+
--dependency-library-name=aws.cryptography.primitives=github.com/aws/aws-cryptographic-material-providers-library/primitives \
76+
--dependency-library-name=aws.cryptography.materialProviders=github.com/aws/aws-cryptographic-material-providers-library/mpl \
77+
--dependency-library-name=sdk.com.amazonaws.dynamodb=github.com/aws/aws-sdk-go-v2/service/dynamodb \
78+
--dependency-library-name=sdk.com.amazonaws.kms=github.com/aws/aws-sdk-go-v2/service/kms
79+
80+
81+
TRANSLATION_RECORD_GO := \
82+
mpl/StandardLibrary/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr \
83+
mpl/ComAmazonawsKms/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr \
84+
mpl/ComAmazonawsDynamodb/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr \
85+
mpl/AwsCryptographyPrimitives/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr \
86+
mpl/AwsCryptographicMaterialProviders/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr
87+
88+
TYPES_FILE_PATH=dafny/AwsEncryptionSdk/Model/AwsCryptographyEncryptionSdkTypes.dfy
89+
TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"software.amazon.cryptography.encryptionsdk.internaldafny.types\" } AwsCryptographyEncryptionSdkTypes"
90+
TYPES_FILE_WITHOUT_EXTERN_STRING="module AwsCryptographyEncryptionSdkTypes"
91+
92+
INDEX_FILE_PATH=dafny/AwsEncryptionSdk/src/Index.dfy
93+
INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"software.amazon.cryptography.encryptionsdk.internaldafny\" } ESDK refines AbstractAwsCryptographyEncryptionSdkService {"
94+
INDEX_FILE_WITHOUT_EXTERN_STRING="module ESDK refines AbstractAwsCryptographyEncryptionSdkService {"

AwsEncryptionSDK/dafny/AwsEncryptionSdk/src/Index.dfy

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
include "AwsEncryptionSdkOperations.dfy"
55

6-
module
7-
{:extern "software.amazon.cryptography.encryptionsdk.internaldafny" }
8-
ESDK refines AbstractAwsCryptographyEncryptionSdkService {
6+
module {:extern "software.amazon.cryptography.encryptionsdk.internaldafny" } ESDK refines AbstractAwsCryptographyEncryptionSdkService {
97
import Operations = AwsEncryptionSdkOperations
108
import Primitives = AtomicPrimitives
119
import MaterialProviders

AwsEncryptionSDK/runtimes/go/ImplementationFromDafny-go/awscryptographyencryptionsdksmithygenerated/api_client.go

+68
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)