Skip to content

Commit bdc7446

Browse files
lucasmcdonald3josecorella
authored andcommitted
m
1 parent bceac3b commit bdc7446

File tree

1 file changed

+189
-0
lines changed

1 file changed

+189
-0
lines changed

.github/workflows/library_interop_test_vectors.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,174 @@ jobs:
3333
id-token: write
3434
contents: read
3535

36+
# TestVectors will call KMS
37+
- name: Configure AWS Credentials
38+
uses: aws-actions/configure-aws-credentials@v2
39+
with:
40+
aws-region: us-west-2
41+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
42+
role-session-name: InterOpTests
43+
44+
- uses: actions/checkout@v3
45+
# Not all submodules are needed.
46+
# We manually pull the submodule we DO need.
47+
- run: git submodule update --init libraries
48+
- run: git submodule update --init --recursive mpl
49+
50+
# Set up runtimes
51+
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
52+
if: matrix.language == 'net'
53+
uses: actions/setup-dotnet@v3
54+
with:
55+
dotnet-version: ${{ matrix.dotnet-version }}
56+
57+
# Setup Java in Rust is needed for running polymorph
58+
- name: Setup Java 17
59+
if: matrix.language == 'java' || matrix.language == 'rust'
60+
uses: actions/setup-java@v3
61+
with:
62+
distribution: "corretto"
63+
java-version: 17
64+
65+
- name: Setup Python for running tests
66+
if: matrix.language == 'python'
67+
uses: actions/setup-python@v4
68+
with:
69+
python-version: 3.11
70+
architecture: x64
71+
- run: |
72+
python -m pip install --upgrade pip
73+
pip install --upgrade tox
74+
pip install poetry
75+
76+
- name: Setup Rust Toolchain for GitHub CI
77+
if: matrix.language == 'rust'
78+
uses: actions-rust-lang/[email protected]
79+
with:
80+
components: rustfmt
81+
# TODO - uncomment this after Rust formatter works
82+
# - name: Rustfmt Check
83+
# uses: actions-rust-lang/rustfmt@v1
84+
85+
# TODO: Remove this after the formatting in Rust starts working
86+
- name: smithy-dafny Rust hacks
87+
if: matrix.language == 'rust'
88+
shell: bash
89+
run: |
90+
if [ "$RUNNER_OS" == "macOS" ]; then
91+
sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
92+
else
93+
sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
94+
fi
95+
96+
- name: Setup NASM for Windows in Rust (aws-lc-sys)
97+
if: matrix.language == 'rust' && matrix.os == 'windows-latest'
98+
uses: ilammy/setup-nasm@v1
99+
100+
- name: Setup Dafny
101+
uses: dafny-lang/[email protected]
102+
with:
103+
dafny-version: ${{ inputs.dafny }}
104+
105+
- name: Regenerate code using smithy-dafny if necessary
106+
if: ${{ inputs.regenerate-code }}
107+
uses: ./.github/actions/polymorph_codegen
108+
with:
109+
dafny: ${{ inputs.dafny }}
110+
library: ${{ matrix.library }}
111+
diff-generated-code: false
112+
113+
# Build implementation for each runtime
114+
- name: Build ${{ matrix.library }} implementation in Java
115+
if: matrix.language == 'java'
116+
shell: bash
117+
working-directory: ./${{ matrix.library }}
118+
run: |
119+
# This works because `node` is installed by default on GHA runners
120+
CORES=$(node -e 'console.log(os.cpus().length)')
121+
make build_java CORES=$CORES
122+
123+
- name: Build ${{ matrix.library }} implementation in .NET
124+
if: matrix.language == 'net'
125+
shell: bash
126+
working-directory: ./${{ matrix.library }}
127+
run: |
128+
# This works because `node` is installed by default on GHA runners
129+
CORES=$(node -e 'console.log(os.cpus().length)')
130+
make transpile_net
131+
132+
- name: Install Smithy-Dafny codegen dependencies
133+
if: matrix.language == 'rust'
134+
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
135+
136+
# TODO: Remove this after checking in Rust polymorph code
137+
- name: Run make polymorph_rust
138+
if: matrix.language == 'rust'
139+
shell: bash
140+
working-directory: ./${{ matrix.library }}
141+
run: |
142+
make polymorph_rust
143+
144+
- name: Build ${{ matrix.library }} implementation in Rust
145+
if: matrix.language == 'rust'
146+
shell: bash
147+
working-directory: ./${{ matrix.library }}
148+
run: |
149+
CORES=$(node -e 'console.log(os.cpus().length)')
150+
make transpile_rust CORES=$CORES
151+
152+
- name: Build ${{ matrix.library }} implementation in Python
153+
if: matrix.language == 'python'
154+
shell: bash
155+
working-directory: ./${{ matrix.library }}
156+
run: |
157+
# This works because `node` is installed by default on GHA runners
158+
CORES=$(node -e 'console.log(os.cpus().length)')
159+
make transpile_python CORES=$CORES
160+
161+
- name: Setup gradle
162+
if: matrix.language == 'java'
163+
uses: gradle/gradle-build-action@v2
164+
with:
165+
gradle-version: 7.2
166+
167+
- name: Create Manifests
168+
working-directory: ./${{ matrix.library }}
169+
run: make test_generate_vectors_${{ matrix.language }}
170+
171+
- name: Create Encrypt Manifests
172+
working-directory: ./${{ matrix.library }}
173+
run: make test_encrypt_vectors_${{ matrix.language }}
174+
175+
- name: Upload Encrypt Manifest and keys.json files
176+
uses: actions/upload-artifact@v4
177+
with:
178+
name: ${{matrix.os}}_vector_artifact_${{matrix.language}}_${{github.sha}}
179+
path: |
180+
./${{matrix.library}}/runtimes/${{matrix.language}}/*.json
181+
./${{matrix.library}}/runtimes/${{matrix.language}}/plaintexts
182+
./${{matrix.library}}/runtimes/${{matrix.language}}/ciphertexts
183+
184+
testInteroperablity:
185+
needs: generateEncryptVectors
186+
strategy:
187+
matrix:
188+
library: [TestVectors]
189+
os: [
190+
# https://taskei.amazon.dev/tasks/CrypTool-5283
191+
# windows-latest,
192+
ubuntu-latest,
193+
macos-13,
194+
]
195+
encrypting_language: [java, net, rust, python]
196+
decrypting_language: [java, net, rust, python]
197+
# https://taskei.amazon.dev/tasks/CrypTool-5284
198+
dotnet-version: ["6.0.x"]
199+
runs-on: ${{ matrix.os }}
200+
permissions:
201+
id-token: write
202+
contents: read
203+
36204
steps:
37205
- name: Support longpaths on Git checkout
38206
run: |
@@ -238,6 +406,17 @@ jobs:
238406
distribution: "corretto"
239407
java-version: 17
240408

409+
- name: Setup Python for running tests
410+
if: matrix.decrypting_language == == 'python'
411+
uses: actions/setup-python@v4
412+
with:
413+
python-version: 3.11
414+
architecture: x64
415+
- run: |
416+
python -m pip install --upgrade pip
417+
pip install --upgrade tox
418+
pip install poetry
419+
241420
- name: Setup Rust Toolchain for GitHub CI
242421
if: matrix.decrypting_language == 'rust'
243422
uses: actions-rust-lang/[email protected]
@@ -315,6 +494,7 @@ jobs:
315494
CORES=$(node -e 'console.log(os.cpus().length)')
316495
make transpile_rust CORES=$CORES
317496
497+
<<<<<<< HEAD
318498
- name: Build ${{ matrix.library }} implementation in Go
319499
if: matrix.decrypting_language == 'go'
320500
shell: bash
@@ -331,6 +511,15 @@ jobs:
331511
working-directory: ./${{ matrix.library }}
332512
run: |
333513
make purge_polymorph_code
514+
=======
515+
- name: Build ${{ matrix.library }} implementation in Python
516+
if: matrix.decrypting_language == 'python'
517+
shell: bash
518+
working-directory: ./${{ matrix.library }}
519+
run: |
520+
CORES=$(node -e 'console.log(os.cpus().length)')
521+
make transpile_python CORES=$CORES
522+
>>>>>>> a812a13f (m)
334523

335524
- name: Download Encrypt Manifest Artifact
336525
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)