-
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 branch information
1 parent
28ab9c3
commit cc0dea2
Showing
2 changed files
with
109 additions
and
1 deletion.
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
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 |
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