2525 ubuntu-latest,
2626 macos-13,
2727 ]
28- language : [java, net]
28+ language : [java, net, rust ]
2929 # https://taskei.amazon.dev/tasks/CrypTool-5284
3030 dotnet-version : ["6.0.x"]
3131 runs-on : ${{ matrix.os }}
3838 run : |
3939 git config --global core.longpaths true
4040
41+ # TestVectors will call KMS
42+ - name : Configure AWS Credentials
43+ uses : aws-actions/configure-aws-credentials@v2
44+ with :
45+ aws-region : us-west-2
46+ role-to-assume : arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
47+ role-session-name : InterOpTests
48+
4149 - uses : actions/checkout@v3
4250 # Not all submodules are needed.
4351 # We manually pull the submodule we DO need.
@@ -51,15 +59,40 @@ jobs:
5159 with :
5260 dotnet-version : ${{ matrix.dotnet-version }}
5361
62+ # Setup Java in Rust is needed for running polymorph
5463 - name : Setup Java 17
55- if : matrix.language == 'java'
64+ if : matrix.language == 'java' || matrix.language == 'rust'
5665 uses : actions/setup-java@v3
5766 with :
5867 distribution : " corretto"
5968 java-version : 17
6069
70+ - name : Setup Rust Toolchain for GitHub CI
71+ if : matrix.language == 'rust'
72+ uses : actions-rust-lang/setup-rust-toolchain@v1.10.1
73+ with :
74+ components : rustfmt
75+ # TODO - uncomment this after Rust formatter works
76+ # - name: Rustfmt Check
77+ # uses: actions-rust-lang/rustfmt@v1
78+
79+ # TODO: Remove this after the formatting in Rust starts working
80+ - name : smithy-dafny Rust hacks
81+ if : matrix.language == 'rust'
82+ shell : bash
83+ run : |
84+ if [ "$RUNNER_OS" == "macOS" ]; then
85+ sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
86+ else
87+ sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
88+ fi
89+
90+ - name : Setup NASM for Windows in Rust (aws-lc-sys)
91+ if : matrix.language == 'rust' && matrix.os == 'windows-latest'
92+ uses : ilammy/setup-nasm@v1
93+
6194 - name : Setup Dafny
62- uses : dafny-lang/setup-dafny-action@v1.6.1
95+ uses : dafny-lang/setup-dafny-action@v1.7.0
6396 with :
6497 dafny-version : ${{ inputs.dafny }}
6598
@@ -89,21 +122,33 @@ jobs:
89122 # This works because `node` is installed by default on GHA runners
90123 CORES=$(node -e 'console.log(os.cpus().length)')
91124 make transpile_net
92-
125+
126+ - name : Install Smithy-Dafny codegen dependencies
127+ if : matrix.language == 'rust'
128+ uses : ./.github/actions/install_smithy_dafny_codegen_dependencies
129+
130+ # TODO: Remove this after checking in Rust polymorph code
131+ - name : Run make polymorph_rust
132+ if : matrix.language == 'rust'
133+ shell : bash
134+ working-directory : ./${{ matrix.library }}
135+ run : |
136+ make polymorph_rust
137+
138+ - name : Build ${{ matrix.library }} implementation in Rust
139+ if : matrix.language == 'rust'
140+ shell : bash
141+ working-directory : ./${{ matrix.library }}
142+ run : |
143+ CORES=$(node -e 'console.log(os.cpus().length)')
144+ make transpile_rust CORES=$CORES
145+
93146 - name : Setup gradle
94147 if : matrix.language == 'java'
95148 uses : gradle/gradle-build-action@v2
96149 with :
97150 gradle-version : 7.2
98151
99- # TestVectors will call KMS
100- - name : Configure AWS Credentials
101- uses : aws-actions/configure-aws-credentials@v2
102- with :
103- aws-region : us-west-2
104- role-to-assume : arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
105- role-session-name : InterOpTests
106-
107152 - name : Create Manifests
108153 working-directory : ./${{ matrix.library }}
109154 run : make test_generate_vectors_${{ matrix.language }}
@@ -132,8 +177,8 @@ jobs:
132177 ubuntu-latest,
133178 macos-13,
134179 ]
135- encrypting_language : [java, net]
136- decrypting_language : [java, net]
180+ encrypting_language : [java, net, rust ]
181+ decrypting_language : [java, net, rust ]
137182 # https://taskei.amazon.dev/tasks/CrypTool-5284
138183 dotnet-version : ["6.0.x"]
139184 runs-on : ${{ matrix.os }}
@@ -145,6 +190,7 @@ jobs:
145190 - name : Support longpaths on Git checkout
146191 run : |
147192 git config --global core.longpaths true
193+
148194 # TestVectors will call KMS
149195 - name : Configure AWS Credentials
150196 uses : aws-actions/configure-aws-credentials@v2
@@ -159,19 +205,45 @@ jobs:
159205 - run : git submodule update --init libraries
160206 - run : git submodule update --init --recursive mpl
161207
208+ # Set up runtimes
162209 - name : Setup .NET Core SDK ${{ matrix.dotnet-version }}
163210 if : matrix.decrypting_language == 'net'
164211 uses : actions/setup-dotnet@v3
165212 with :
166213 dotnet-version : ${{ matrix.dotnet-version }}
167214
215+ # Setup Java in Rust is needed for running polymorph
168216 - name : Setup Java 17
169- if : matrix.decrypting_language == 'java'
217+ if : matrix.decrypting_language == 'java' || matrix.decrypting_language == 'rust'
170218 uses : actions/setup-java@v3
171219 with :
172220 distribution : " corretto"
173221 java-version : 17
174222
223+ - name : Setup Rust Toolchain for GitHub CI
224+ if : matrix.decrypting_language == 'rust'
225+ uses : actions-rust-lang/setup-rust-toolchain@v1.10.1
226+ with :
227+ components : rustfmt
228+ # TODO - uncomment this after Rust formatter works
229+ # - name: Rustfmt Check
230+ # uses: actions-rust-lang/rustfmt@v1
231+
232+ # TODO: Remove this after the formatting in Rust starts working
233+ - name : smithy-dafny Rust hacks
234+ if : matrix.decrypting_language == 'rust'
235+ shell : bash
236+ run : |
237+ if [ "$RUNNER_OS" == "macOS" ]; then
238+ sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
239+ else
240+ sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk
241+ fi
242+
243+ - name : Setup NASM for Windows in Rust (aws-lc-sys)
244+ if : matrix.decrypting_language == 'rust' && matrix.os == 'windows-latest'
245+ uses : ilammy/setup-nasm@v1
246+
175247 - name : Setup Dafny
176248 uses : dafny-lang/setup-dafny-action@v1.6.1
177249 with :
@@ -204,6 +276,26 @@ jobs:
204276 CORES=$(node -e 'console.log(os.cpus().length)')
205277 make transpile_net
206278
279+ - name : Install Smithy-Dafny codegen dependencies
280+ if : matrix.decrypting_language == 'rust'
281+ uses : ./.github/actions/install_smithy_dafny_codegen_dependencies
282+
283+ # TODO: Remove this after checking in Rust polymorph code
284+ - name : Run make polymorph_rust
285+ if : matrix.decrypting_language == 'rust'
286+ shell : bash
287+ working-directory : ./${{ matrix.library }}
288+ run : |
289+ make polymorph_rust
290+
291+ - name : Build ${{ matrix.library }} implementation in Rust
292+ if : matrix.decrypting_language == 'rust'
293+ shell : bash
294+ working-directory : ./${{ matrix.library }}
295+ run : |
296+ CORES=$(node -e 'console.log(os.cpus().length)')
297+ make transpile_rust CORES=$CORES
298+
207299 - name : Download Encrypt Manifest Artifact
208300 uses : actions/download-artifact@v4
209301 with :
0 commit comments