Skip to content

Commit 4b07204

Browse files
committed
chore(GHA): add backwards interop dafny tests
1 parent 079c3c1 commit 4b07204

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

.github/workflows/dafny-interop.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
# This workflow is for testing backwards compatibility of a dafny version
3+
# and tests if a project that consumes the mpl will be backwards compatible with
4+
# a newer version of Dafny
5+
name: Dafny Interoperability Test
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
mpl-dafny:
11+
description: "The Dafny version to compile the MPL with (4.2.0, dafny-nightly, etc..)"
12+
required: true
13+
type: string
14+
mpl-commit:
15+
description: "The MPL commit to use"
16+
required: false
17+
default: "HEAD"
18+
type: string
19+
dbesdk-dafny:
20+
description: "The Dafny version to compile the DBESDK with (4.2.0, dafny-nightly, etc..)"
21+
required: true
22+
type: string
23+
24+
jobs:
25+
dafny-interop-java:
26+
uses: ./.github/workflows/dafny_interop_java.yml
27+
with:
28+
mpl-dafny: ${{inputs.mpl-dafny}}
29+
mpl-commit: ${{inputs.mpl-commit}}
30+
dbesdk-dafny: ${{inputs.dbesdk-dafny}}
31+
# dafny-interop-java-test-vectors:
32+
# uses: ./.github/workflows/ci_test_vector_java.yml
33+
# with:
34+
# mpl-dafny: ${{inputs.mpl-dafny}}
35+
# mpl-commit: ${{inputs.mpl-commit}}
36+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
37+
# dafny-interop-java-examples:
38+
# uses: ./.github/workflows/ci_examples_java.yml
39+
# with:
40+
# mpl-dafny: ${{inputs.mpl-dafny}}
41+
# mpl-commit: ${{inputs.mpl-commit}}
42+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
43+
# dafny-interop-net:
44+
# uses: ./.github/workflows/ci_test_net.yml
45+
# with:
46+
# mpl-dafny: ${{inputs.mpl-dafny}}
47+
# mpl-commit: ${{inputs.mpl-commit}}
48+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
49+
# dafny-interop-net-test-vectors:
50+
# uses: ./.github/workflows/ci_test_vector_net.yml
51+
# with:
52+
# mpl-dafny: ${{inputs.mpl-dafny}}
53+
# mpl-commit: ${{inputs.mpl-commit}}
54+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
55+
# dafny-interop-net-examples:
56+
# uses: ./.github/workflows/ci_examples_net.yml
57+
# with:
58+
# mpl-dafny: ${{inputs.mpl-dafny}}
59+
# mpl-commit: ${{inputs.mpl-commit}}
60+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# This workflow performs tests in Java.
2+
name: Library Java tests
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
mpl-dafny:
8+
description: "The Dafny version to compile the MPL with (4.2.0, dafny-nightly, etc..)"
9+
required: true
10+
type: string
11+
mpl-commit:
12+
description: "The MPL commit to use"
13+
required: false
14+
default: "main"
15+
type: string
16+
dbesdk-dafny:
17+
description: "The Dafny version to compile the DBESDK with (4.2.0, dafny-nightly, etc..)"
18+
required: true
19+
type: string
20+
21+
jobs:
22+
testJava:
23+
strategy:
24+
matrix:
25+
library: [DynamoDbEncryption]
26+
java-version: [8, 11, 16, 17]
27+
os: [macos-12]
28+
runs-on: ${{ matrix.os }}
29+
permissions:
30+
id-token: write
31+
contents: read
32+
steps:
33+
- name: Configure AWS Credentials
34+
uses: aws-actions/configure-aws-credentials@v4
35+
with:
36+
aws-region: us-west-2
37+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2
38+
role-session-name: DDBEC-Dafny-Java-Tests
39+
40+
- uses: actions/checkout@v3
41+
with:
42+
submodules: recursive
43+
fetch-depth: 0
44+
45+
- name: Setup MPL Dafny
46+
uses: dafny-lang/[email protected]
47+
with:
48+
dafny-version: ${{ inputs.mpl-dafny }}
49+
50+
- name: Update MPL submodule if using MPL HEAD
51+
working-directory: submodules/MaterialProviders
52+
run: |
53+
git fetch
54+
git checkout ${{inputs.mpl-commit}}
55+
git pull
56+
git submodule update --init --recursive
57+
git rev-parse HEAD
58+
59+
- name: Setup Java ${{ matrix.java-version }}
60+
uses: actions/setup-java@v4
61+
with:
62+
distribution: "corretto"
63+
java-version: ${{ matrix.java-version }}
64+
65+
- name: Build MPL with Dafny ${{inputs.mpl-dafny}}
66+
working-directory: submodules/MaterialProviders/submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders
67+
run: |
68+
# This works because `node` is installed by default on GHA runners
69+
CORES=$(node -e 'console.log(os.cpus().length)')
70+
make build_java CORES=$CORES
71+
72+
- name: Setup DBESDK Dafny
73+
uses: dafny-lang/[email protected]
74+
with:
75+
dafny-version: ${{ inputs.dbesdk-dafny}}
76+
77+
- name: Build ${{ matrix.library }} implementation
78+
shell: bash
79+
working-directory: ./${{ matrix.library }}
80+
run: |
81+
make transpile_implementation_java
82+
make transpile_test_java
83+
84+
- name: Test ${{ matrix.library }}
85+
working-directory: ./${{ matrix.library }}
86+
run: |
87+
make test_java

0 commit comments

Comments
 (0)