Skip to content

Commit 3b2e22c

Browse files
committed
m
1 parent 31a842a commit 3b2e22c

File tree

1 file changed

+54
-198
lines changed

1 file changed

+54
-198
lines changed

.github/workflows/library_interop_test_vectors.yml

Lines changed: 54 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@ jobs:
2525
ubuntu-22.04,
2626
macos-13,
2727
]
28-
language: [java, net, rust, go]
28+
language: [java, net, rust, go, python]
2929
# https://taskei.amazon.dev/tasks/CrypTool-5284
3030
dotnet-version: ["6.0.x"]
3131
runs-on: ${{ matrix.os }}
3232
permissions:
3333
id-token: write
34-
contents: read
34+
contents: read
35+
steps:
36+
- name: Support longpaths on Git checkout
37+
run: |
38+
git config --global core.longpaths true
3539
3640
# TestVectors will call KMS
3741
- name: Configure AWS Credentials
@@ -83,6 +87,15 @@ jobs:
8387
# uses: actions-rust-lang/rustfmt@v1
8488

8589
# TODO: Remove this after the formatting in Rust starts working
90+
- name: Setup Go
91+
uses: actions/setup-go@v5
92+
with:
93+
go-version: "1.23"
94+
95+
- name: Install Go imports
96+
run: |
97+
go install golang.org/x/tools/cmd/goimports@latest
98+
8699
- name: smithy-dafny Rust hacks
87100
if: matrix.language == 'rust'
88101
shell: bash
@@ -157,6 +170,23 @@ jobs:
157170
# This works because `node` is installed by default on GHA runners
158171
CORES=$(node -e 'console.log(os.cpus().length)')
159172
make transpile_python CORES=$CORES
173+
174+
- name: Build ${{ matrix.library }} implementation in Go
175+
if: matrix.language == 'go'
176+
shell: bash
177+
working-directory: ./${{ matrix.library }}
178+
run: |
179+
# This works because `node` is installed by default on GHA runners
180+
CORES=$(node -e 'console.log(os.cpus().length)')
181+
make transpile_go
182+
183+
# TODO: Remove this after Go polymorph does not generate unwanted duplicate code.
184+
- name: Purge polymorph code in Go
185+
if: matrix.language == 'go'
186+
shell: bash
187+
working-directory: ./${{ matrix.library }}
188+
run: |
189+
make purge_polymorph_code
160190
161191
- name: Setup gradle
162192
if: matrix.language == 'java'
@@ -193,8 +223,8 @@ jobs:
193223
ubuntu-latest,
194224
macos-13,
195225
]
196-
encrypting_language: [java, net, rust, python]
197-
decrypting_language: [java, net, rust, python]
226+
encrypting_language: [java, net, rust, go, python]
227+
decrypting_language: [java, net, rust, go, python]
198228
# https://taskei.amazon.dev/tasks/CrypTool-5284
199229
dotnet-version: ["6.0.x"]
200230
runs-on: ${{ matrix.os }}
@@ -212,180 +242,9 @@ jobs:
212242
uses: aws-actions/configure-aws-credentials@v2
213243
with:
214244
aws-region: us-west-2
215-
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
245+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
216246
role-session-name: InterOpTests
217-
218-
- uses: actions/checkout@v3
219-
# Not all submodules are needed.
220-
# We manually pull the submodule we DO need.
221-
- run: git submodule update --init libraries
222-
- run: git submodule update --init --recursive mpl
223-
224-
# Set up runtimes
225-
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
226-
if: matrix.language == 'net'
227-
uses: actions/setup-dotnet@v3
228-
with:
229-
dotnet-version: ${{ matrix.dotnet-version }}
230-
231-
# Setup Java in Rust is needed for running polymorph
232-
- name: Setup Java 17
233-
if: matrix.language == 'java' || matrix.language == 'rust'
234-
uses: actions/setup-java@v3
235-
with:
236-
distribution: "corretto"
237-
java-version: 17
238-
239-
- name: Setup Rust Toolchain for GitHub CI
240-
if: matrix.language == 'rust'
241-
uses: actions-rust-lang/[email protected]
242-
with:
243-
components: rustfmt
244-
245-
- name: Setup Go
246-
uses: actions/setup-go@v5
247-
with:
248-
go-version: "1.23"
249-
250-
- name: Install Go imports
251-
run: |
252-
go install golang.org/x/tools/cmd/goimports@latest
253-
254-
- name: Setup NASM for Windows in Rust (aws-lc-sys)
255-
if: matrix.language == 'rust' && matrix.os == 'windows-latest'
256-
uses: ilammy/setup-nasm@v1
257-
258-
- name: Setup Dafny Rust
259-
if: matrix.language == 'rust'
260-
uses: dafny-lang/[email protected]
261-
with:
262-
dafny-version: nightly-2025-01-30-7db1e5f
263-
264-
- name: Setup Dafny Not Rust
265-
if: matrix.language != 'rust'
266-
uses: dafny-lang/[email protected]
267-
with:
268-
dafny-version: ${{ inputs.dafny }}
269-
270-
- name: Regenerate code using smithy-dafny if necessary
271-
if: ${{ inputs.regenerate-code }}
272-
uses: ./.github/actions/polymorph_codegen
273-
with:
274-
dafny: ${{ inputs.dafny }}
275-
library: ${{ matrix.library }}
276-
diff-generated-code: false
277-
278-
# Build implementation for each runtime
279-
- name: Build ${{ matrix.library }} implementation in Java
280-
if: matrix.language == 'java'
281-
shell: bash
282-
working-directory: ./${{ matrix.library }}
283-
run: |
284-
# This works because `node` is installed by default on GHA runners
285-
CORES=$(node -e 'console.log(os.cpus().length)')
286-
make build_java CORES=$CORES
287-
288-
- name: Build ${{ matrix.library }} implementation in .NET
289-
if: matrix.language == 'net'
290-
shell: bash
291-
working-directory: ./${{ matrix.library }}
292-
run: |
293-
# This works because `node` is installed by default on GHA runners
294-
CORES=$(node -e 'console.log(os.cpus().length)')
295-
make transpile_net
296-
297-
- name: Install Smithy-Dafny codegen dependencies
298-
if: matrix.language == 'rust'
299-
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
300-
301-
- name: Run make polymorph_rust
302-
if: matrix.language == 'rust'
303-
shell: bash
304-
working-directory: ./${{ matrix.library }}
305-
run: |
306-
make polymorph_rust
307-
308-
- name: Build ${{ matrix.library }} implementation in Rust
309-
if: matrix.language == 'rust'
310-
shell: bash
311-
working-directory: ./${{ matrix.library }}
312-
run: |
313-
CORES=$(node -e 'console.log(os.cpus().length)')
314-
make transpile_rust CORES=$CORES
315-
316-
- name: Build ${{ matrix.library }} implementation in Go
317-
if: matrix.language == 'go'
318-
shell: bash
319-
working-directory: ./${{ matrix.library }}
320-
run: |
321-
# This works because `node` is installed by default on GHA runners
322-
CORES=$(node -e 'console.log(os.cpus().length)')
323-
make transpile_go
324-
325-
# TODO: Remove this after Go polymorph does not generate unwanted duplicate code.
326-
- name: Purge polymorph code in Go
327-
if: matrix.language == 'go'
328-
shell: bash
329-
working-directory: ./${{ matrix.library }}
330-
run: |
331-
make purge_polymorph_code
332-
333-
- name: Setup gradle
334-
if: matrix.language == 'java'
335-
uses: gradle/gradle-build-action@v2
336-
with:
337-
gradle-version: 7.2
338-
339-
- name: Create Manifests
340-
working-directory: ./${{ matrix.library }}
341-
run: make test_generate_vectors_${{ matrix.language }}
342-
343-
- name: Create Encrypt Manifests
344-
working-directory: ./${{ matrix.library }}
345-
run: make test_encrypt_vectors_${{ matrix.language }}
346-
347-
- name: Upload Encrypt Manifest and keys.json files
348-
uses: actions/upload-artifact@v4
349-
with:
350-
name: ${{matrix.os}}_vector_artifact_${{matrix.language}}_${{github.sha}}
351-
path: |
352-
./${{matrix.library}}/runtimes/${{matrix.language}}/*.json
353-
./${{matrix.library}}/runtimes/${{matrix.language}}/plaintexts
354-
./${{matrix.library}}/runtimes/${{matrix.language}}/ciphertexts
355-
356-
testInteroperablity:
357-
needs: generateEncryptVectors
358-
strategy:
359-
matrix:
360-
library: [TestVectors]
361-
os: [
362-
# https://taskei.amazon.dev/tasks/CrypTool-5283
363-
# windows-latest,
364-
ubuntu-22.04,
365-
macos-13,
366-
]
367-
encrypting_language: [java, net, rust, go]
368-
decrypting_language: [java, net, rust, go]
369-
# https://taskei.amazon.dev/tasks/CrypTool-5284
370-
dotnet-version: ["6.0.x"]
371-
runs-on: ${{ matrix.os }}
372-
permissions:
373-
id-token: write
374-
contents: read
375-
376-
steps:
377-
- name: Support longpaths on Git checkout
378-
run: |
379-
git config --global core.longpaths true
380-
381-
# TestVectors will call KMS
382-
- name: Configure AWS Credentials
383-
uses: aws-actions/configure-aws-credentials@v2
384-
with:
385-
aws-region: us-west-2
386-
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
387-
role-session-name: InterOpTests
388-
247+
389248
- uses: actions/checkout@v3
390249
# Not all submodules are needed.
391250
# We manually pull the submodule we DO need.
@@ -423,29 +282,27 @@ jobs:
423282
uses: actions-rust-lang/[email protected]
424283
with:
425284
components: rustfmt
285+
# TODO - uncomment this after Rust formatter works
286+
# - name: Rustfmt Check
287+
# uses: actions-rust-lang/rustfmt@v1
426288

427-
- name: Setup Go
428-
uses: actions/setup-go@v5
429-
with:
430-
go-version: "1.23"
431-
432-
- name: Install Go imports
289+
# TODO: Remove this after the formatting in Rust starts working
290+
- name: smithy-dafny Rust hacks
291+
if: matrix.decrypting_language == 'rust'
292+
shell: bash
433293
run: |
434-
go install golang.org/x/tools/cmd/goimports@latest
294+
if [ "$RUNNER_OS" == "macOS" ]; then
295+
sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
296+
else
297+
sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
298+
fi
435299
436300
- name: Setup NASM for Windows in Rust (aws-lc-sys)
437301
if: matrix.decrypting_language == 'rust' && matrix.os == 'windows-latest'
438302
uses: ilammy/setup-nasm@v1
439303

440-
- name: Setup Dafny Rust
441-
if: matrix.decrypting_language == 'rust'
442-
uses: dafny-lang/[email protected]
443-
with:
444-
dafny-version: nightly-2025-01-30-7db1e5f
445-
446-
- name: Setup Dafny Not Rust
447-
if: matrix.decrypting_language != 'rust'
448-
uses: dafny-lang/[email protected]
304+
- name: Setup Dafny
305+
uses: dafny-lang/[email protected]
449306
with:
450307
dafny-version: ${{ inputs.dafny }}
451308

@@ -479,7 +336,8 @@ jobs:
479336
- name: Install Smithy-Dafny codegen dependencies
480337
if: matrix.decrypting_language == 'rust'
481338
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
482-
339+
340+
# TODO: Remove this after checking in Rust polymorph code
483341
- name: Run make polymorph_rust
484342
if: matrix.decrypting_language == 'rust'
485343
shell: bash
@@ -494,8 +352,7 @@ jobs:
494352
run: |
495353
CORES=$(node -e 'console.log(os.cpus().length)')
496354
make transpile_rust CORES=$CORES
497-
498-
<<<<<<< HEAD
355+
499356
- name: Build ${{ matrix.library }} implementation in Go
500357
if: matrix.decrypting_language == 'go'
501358
shell: bash
@@ -512,15 +369,14 @@ jobs:
512369
working-directory: ./${{ matrix.library }}
513370
run: |
514371
make purge_polymorph_code
515-
=======
372+
516373
- name: Build ${{ matrix.library }} implementation in Python
517374
if: matrix.decrypting_language == 'python'
518375
shell: bash
519376
working-directory: ./${{ matrix.library }}
520377
run: |
521378
CORES=$(node -e 'console.log(os.cpus().length)')
522379
make transpile_python CORES=$CORES
523-
>>>>>>> a812a13f (m)
524380
525381
- name: Download Encrypt Manifest Artifact
526382
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)