Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
ajewellamz committed Nov 18, 2024
1 parent 28ab9c3 commit cc0dea2
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 1 deletion.
108 changes: 108 additions & 0 deletions .github/workflows/library_rust_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# 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 libraries
git submodule update --init --recursive smithy-dafny
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2
role-session-name: RustTests

- name: Setup Rust Toolchain for GitHub CI
uses: actions-rust-lang/[email protected]
with:
components: rustfmt
# TODO - uncomment this after Rust formatter works
# - name: Rustfmt Check
# uses: actions-rust-lang/rustfmt@v1

# TODO: Use setup-dafny-actions with correct version when Dafny releases 4.8.2
- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
dafny-version: 4.9.0

# TODO: 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|#&|' smithy-dafny/SmithyDafnyMakefile.mk
else
sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' 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: Test ${{ matrix.library }} Rust
shell: bash
working-directory: ./${{ matrix.library }}
run: |
make test_rust
2 changes: 1 addition & 1 deletion DynamoDbEncryption/runtimes/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ aws-sdk-kms = "1.47.0"
aws-smithy-runtime-api = {version = "1.7.2", features = ["client"] }
aws-smithy-types = "1.2.8"
chrono = "0.4.38"
dafny_runtime = { path = "../../../submodules/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust"}
dafny_runtime = { path = "../../../submodules/MaterialProviders/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust"}
dashmap = "6.1.0"
pem = "3.0.4"
tokio = {version = "1.41.0", features = ["full"] }
Expand Down

0 comments on commit cc0dea2

Please sign in to comment.