Skip to content

Commit

Permalink
test in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
josecorella committed Nov 1, 2024
1 parent 15377f3 commit 6d453b3
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 5 deletions.
110 changes: 108 additions & 2 deletions .github/workflows/library_interop_test_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
CORES=$(node -e 'console.log(os.cpus().length)')
make transpile_net
make write_correct_main_net
- name: Setup gradle
if: matrix.language == 'java'
uses: gradle/gradle-build-action@v2
Expand All @@ -103,12 +104,117 @@ jobs:
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
role-session-name: NetTests
role-session-name: InterOpTests

- name: Create Manifests
working-directory: ./${{ matrix.library }}
run: make test_generate_vectors_${{ matrix.language }}

- name: Create Encrypt Manifests
working-directory: ./${{ matrix.library }}
run: make test_encrypt_vectors_${{ matrix.language }}
run: make test_encrypt_vectors_${{ matrix.language }}

- name: Upload Encrypt Manifest and keys.json files
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}_vector_artifact_${{matrix.language}}
path: |
./${{matrix.library}}/runtimes/${{matrix.language}}/*.json
./${{matrix.library}}/runtimes/${{matrix.language}}/plaintexts
./${{matrix.library}}/runtimes/${{matrix.language}}/ciphertexts
testInteroperablity:
needs: generateEncryptVectors
strategy:
matrix:
library: [TestVectors]
os: [
# https://taskei.amazon.dev/tasks/CrypTool-5283
# windows-latest,
ubuntu-latest,
macos-12,
]
language: [java, net]
# https://taskei.amazon.dev/tasks/CrypTool-5284
dotnet-version: ["6.0.x"]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read

steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true
# TestVectors will call KMS
- 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-Public-ESDK-Dafny-Role-us-west-2
role-session-name: InterOpTests

- uses: actions/checkout@v3
# Not all submodules are needed.
# We manually pull the submodule we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init --recursive mpl

# Set up runtimes
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
if: matrix.decrypting_language == 'net'
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Setup Java 17
if: matrix.decrypting_language == 'java'
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: 17

- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
dafny-version: ${{ inputs.dafny }}

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ inputs.dafny }}
library: ${{ matrix.library }}
diff-generated-code: false

# Build implementation for each runtime
- name: Build ${{ matrix.library }} implementation in Java
if: matrix.language == 'java'
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 build_java CORES=$CORES
make write_correct_main_java
- name: Build ${{ matrix.library }} implementation in .NET
if: matrix.language == 'net'
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_net
make write_correct_main_net
- name: Download Encrypt Manifest Artifact
uses: actions/download-artifact@v4
with:
name: ${{matrix.os}}_vector_artifact_${{matrix.encrypting_language}}
path: ./${{matrix.library}}/runtimes/${{matrix.decrypting_language}}

- name: Decrypt Encrypt Manifest
working-directory: ./${{ matrix.library }}
run: make test_decrypt_encrypt_vectors_${{matrix.decrypting_language}}

9 changes: 7 additions & 2 deletions TestVectors/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ ImplementationFromDafny-cs.dtr
TestsFromDafny-cs.dtr
**/bin
**/obj
/runtimes/java/dafny
/runtimes/java/encrypt-manifest.json
runtimes/java/dafny
runtimes/**/encrypt-manifest.json
runtimes/**/decrypt-manifest.json
runtimes/**/keys.json
runtimes/**/ciphertexts/
runtimes/**/plaintexts/

dafny/TestVectors/test/ciphertexts
dafny/TestVectors/test/plaintexts
dafny/TestVectors/test/test.json
Expand Down
2 changes: 1 addition & 1 deletion TestVectors/runtimes/java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ tasks.register<Copy>("copyKeysJSON") {
}

tasks.register<Copy>("copyKeysJSONCurr") {
from(layout.projectDirectory.file("../../dafny/ESDK/TestVectors/keys.json"))
from(layout.projectDirectory.file("../../dafny/TestVectors/test/keys.json"))
into(layout.projectDirectory.dir("."))
}

Expand Down

0 comments on commit 6d453b3

Please sign in to comment.