-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
chore: add rust support (#1376)
* feat: add rust support
- Loading branch information
1 parent
562b3ef
commit 98ddfe9
Showing
100 changed files
with
8,524 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# This workflow performs tests in Rust. | ||
name: Library Rust 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 | ||
|
||
jobs: | ||
testRust: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
library: [DynamoDbEncryption, TestVectors] | ||
# removed windows-latest because somehow it can't build aws-lc in CI | ||
os: [ubuntu-latest, macos-13] | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
id-token: write | ||
contents: read | ||
env: | ||
RUST_MIN_STACK: 104857600 | ||
steps: | ||
- name: Support longpaths on Git checkout | ||
run: | | ||
git config --global core.longpaths true | ||
- 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: 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-Rust-Tests | ||
|
||
- name: Setup Rust Toolchain for GitHub CI | ||
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1 | ||
with: | ||
components: rustfmt | ||
# uncomment this after Rust formatter works | ||
# - name: Rustfmt Check | ||
# uses: actions-rust-lang/rustfmt@v1 | ||
|
||
- name: Setup Dafny | ||
uses: dafny-lang/setup-dafny-action@v1.7.0 | ||
with: | ||
dafny-version: nightly-latest | ||
|
||
# Remove this after the formatting in Rust starts working | ||
- name: smithy-dafny Rust hacks | ||
shell: bash | ||
run: | | ||
if [ "$RUNNER_OS" == "macOS" ]; then | ||
sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' submodules/smithy-dafny/SmithyDafnyMakefile.mk | ||
else | ||
sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' submodules/smithy-dafny/SmithyDafnyMakefile.mk | ||
fi | ||
- name: Setup Java 17 for codegen | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "corretto" | ||
java-version: "17" | ||
|
||
- name: Setup NASM for Windows (aws-lc-sys) | ||
if: matrix.os == 'windows-latest' | ||
uses: ilammy/setup-nasm@v1 | ||
|
||
- name: Install Smithy-Dafny codegen dependencies | ||
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies | ||
|
||
- name: Run make polymorph_rust | ||
shell: bash | ||
working-directory: ./${{ matrix.library }} | ||
run: | | ||
make polymorph_rust | ||
- name: Compile ${{ 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_rust TRANSPILE_TESTS_IN_RUST=1 CORES=$CORES | ||
- name: Copy ${{ matrix.library }} Vector Files | ||
if: ${{ matrix.library == 'TestVectors' }} | ||
shell: bash | ||
working-directory: ./${{ matrix.library }} | ||
run: | | ||
cp runtimes/java/*.json runtimes/rust/ | ||
- name: Test ${{ matrix.library }} Rust | ||
shell: bash | ||
working-directory: ./${{ matrix.library }} | ||
run: | | ||
make test_rust | ||
- name: Test Examples for Rust in ${{ matrix.library }} | ||
if: ${{ matrix.library == 'DynamoDbEncryption' }} | ||
working-directory: ./${{ matrix.library }}/runtimes/rust/ | ||
shell: bash | ||
run: | | ||
cargo run --example main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
submodules | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...on/cryptography/dbencryptionsdk/dynamodb/itemencryptor/internaldafny/types/__default.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types; | ||
|
||
public class __default | ||
extends software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types._ExternBase___default {} |
Oops, something went wrong.