Skip to content

Commit 1e6be80

Browse files
authored
chore(GHA): add backwards interop dafny tests (#1279)
1 parent 7093266 commit 1e6be80

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

.github/workflows/dafny-interop.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This workflow is for testing backwards compatibility of a dafny version
2+
# and tests if a project that consumes the mpl will be backwards compatible with
3+
# a newer version of Dafny
4+
name: Dafny Interoperability Test
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
mpl-dafny:
10+
description: "The Dafny version to compile the MPL with (4.2.0, dafny-nightly, etc..)"
11+
required: true
12+
type: string
13+
mpl-commit:
14+
description: "The MPL commit to use"
15+
required: false
16+
default: "HEAD"
17+
type: string
18+
dbesdk-dafny:
19+
description: "The Dafny version to compile the DBESDK with (4.2.0, dafny-nightly, etc..)"
20+
required: true
21+
type: string
22+
23+
jobs:
24+
dafny-interop-java:
25+
uses: ./.github/workflows/dafny_interop_java.yml
26+
with:
27+
mpl-dafny: ${{inputs.mpl-dafny}}
28+
mpl-commit: ${{inputs.mpl-commit}}
29+
dbesdk-dafny: ${{inputs.dbesdk-dafny}}
30+
# dafny-interop-java-test-vectors:
31+
# uses: ./.github/workflows/ci_test_vector_java.yml
32+
# with:
33+
# mpl-dafny: ${{inputs.mpl-dafny}}
34+
# mpl-commit: ${{inputs.mpl-commit}}
35+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
36+
# dafny-interop-java-examples:
37+
# uses: ./.github/workflows/ci_examples_java.yml
38+
# with:
39+
# mpl-dafny: ${{inputs.mpl-dafny}}
40+
# mpl-commit: ${{inputs.mpl-commit}}
41+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
42+
# dafny-interop-net:
43+
# uses: ./.github/workflows/ci_test_net.yml
44+
# with:
45+
# mpl-dafny: ${{inputs.mpl-dafny}}
46+
# mpl-commit: ${{inputs.mpl-commit}}
47+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
48+
# dafny-interop-net-test-vectors:
49+
# uses: ./.github/workflows/ci_test_vector_net.yml
50+
# with:
51+
# mpl-dafny: ${{inputs.mpl-dafny}}
52+
# mpl-commit: ${{inputs.mpl-commit}}
53+
# dbsesdk-dafny: ${{inputs.dbesdk-dafny}}
54+
# dafny-interop-net-examples:
55+
# uses: ./.github/workflows/ci_examples_net.yml
56+
# with:
57+
# mpl-dafny: ${{inputs.mpl-dafny}}
58+
# mpl-commit: ${{inputs.mpl-commit}}
59+
# 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)