|
19 | 19 | strategy:
|
20 | 20 | fail-fast: false
|
21 | 21 | matrix:
|
| 22 | + library: [AwsEncryptionSDK] |
22 | 23 | os: [
|
23 | 24 | windows-latest,
|
24 | 25 | ubuntu-latest,
|
@@ -53,11 +54,11 @@ jobs:
|
53 | 54 | # TODO - uncomment this after Rust formatter works
|
54 | 55 | # - name: Rustfmt Check
|
55 | 56 | # uses: actions-rust-lang/rustfmt@v1
|
56 |
| - |
| 57 | + |
57 | 58 | - name: Setup Dafny
|
58 | 59 | uses: dafny-lang/[email protected]
|
59 | 60 | with:
|
60 |
| - dafny-version: 4.9.0 |
| 61 | + dafny-version: ${{ inputs.dafny }} |
61 | 62 |
|
62 | 63 | # TODO: Remove this after the formatting in Rust starts working
|
63 | 64 | - name: smithy-dafny Rust hacks
|
@@ -87,59 +88,151 @@ jobs:
|
87 | 88 | uses: ./.github/actions/polymorph_codegen
|
88 | 89 | with:
|
89 | 90 | dafny: ${{ env.DAFNY_VERSION }}
|
90 |
| - library: AwsEncryptionSDK |
| 91 | + library: ${{ matrix.library }} |
91 | 92 | diff-generated-code: false
|
92 | 93 | update-and-regenerate-mpl: true
|
93 | 94 |
|
94 | 95 | # TODO: Remove this after checking in Rust polymorph code
|
| 96 | + # Also uncomment rust check_polymorph_diff for Rust in .github/actions/polymorph_codegen/action.yml |
95 | 97 | - name: Run make polymorph_rust
|
96 | 98 | shell: bash
|
97 |
| - working-directory: ./AwsEncryptionSDK |
| 99 | + working-directory: ${{ matrix.library }} |
98 | 100 | run: |
|
99 | 101 | make polymorph_rust
|
100 | 102 |
|
101 |
| - - name: Compile AwsEncryptionSDK implementation |
| 103 | + - name: Compile ${{ matrix.library }} implementation |
102 | 104 | shell: bash
|
103 |
| - working-directory: ./AwsEncryptionSDK |
| 105 | + working-directory: ${{ matrix.library }} |
104 | 106 | run: |
|
105 | 107 | # This works because `node` is installed by default on GHA runners
|
106 | 108 | CORES=$(node -e 'console.log(os.cpus().length)')
|
107 | 109 | make transpile_rust CORES=$CORES
|
108 | 110 |
|
109 |
| - # Remove Rust hacks once Dafny fixes this |
110 |
| - - name: Update implementation_from_dafny.rs to add deps |
111 |
| - shell: bash |
112 |
| - working-directory: ./AwsEncryptionSDK/runtimes/rust/src |
113 |
| - run: | |
114 |
| - if [ "$RUNNER_OS" == "macOS" ]; then |
115 |
| - sed -i '' '/pub use types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;/a\ |
116 |
| - pub use crate::deps::aws_cryptography_materialProviders;\ |
117 |
| - pub use crate::deps::aws_cryptography_keyStore;\ |
118 |
| - pub use crate::deps::com_amazonaws_kms; |
119 |
| - ' implementation_from_dafny.rs |
120 |
| - else |
121 |
| - sed -i '/pub use types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;/a\ |
122 |
| - pub use crate::deps::aws_cryptography_materialProviders;\ |
123 |
| - pub use crate::deps::aws_cryptography_keyStore;\ |
124 |
| - pub use crate::deps::com_amazonaws_kms; |
125 |
| - ' implementation_from_dafny.rs |
126 |
| - fi |
127 |
| -
|
128 | 111 | - name: Test Linter for Rust examples and implementation_from_dafny.rs
|
129 |
| - working-directory: ./AwsEncryptionSDK/runtimes/rust |
| 112 | + working-directory: ${{ matrix.library }}/runtimes/rust |
130 | 113 | shell: bash
|
131 | 114 | run: |
|
132 | 115 | cargo clippy
|
133 | 116 | cargo clippy --example main
|
134 | 117 |
|
135 | 118 | - name: Test Rust
|
136 |
| - working-directory: ./AwsEncryptionSDK |
| 119 | + working-directory: ${{ matrix.library }} |
137 | 120 | shell: bash
|
138 | 121 | run: |
|
139 | 122 | make test_rust
|
140 | 123 |
|
141 | 124 | - name: Test Examples for Rust
|
142 |
| - working-directory: ./AwsEncryptionSDK/runtimes/rust |
| 125 | + working-directory: ${{ matrix.library }}/runtimes/rust |
143 | 126 | shell: bash
|
144 | 127 | run: |
|
145 | 128 | cargo test --release --examples
|
| 129 | +
|
| 130 | + testVectors: |
| 131 | + strategy: |
| 132 | + fail-fast: false |
| 133 | + matrix: |
| 134 | + library: [TestVectors] |
| 135 | + os: [ |
| 136 | + # Sed script doesn't work properly on windows |
| 137 | + # windows-latest, |
| 138 | + ubuntu-latest, |
| 139 | + macos-13, |
| 140 | + ] |
| 141 | + runs-on: ${{ matrix.os }} |
| 142 | + permissions: |
| 143 | + id-token: write |
| 144 | + contents: read |
| 145 | + steps: |
| 146 | + - name: Support longpaths on Git checkout |
| 147 | + run: | |
| 148 | + git config --global core.longpaths true |
| 149 | + - uses: actions/checkout@v3 |
| 150 | + - name: Init Submodules |
| 151 | + shell: bash |
| 152 | + run: | |
| 153 | + git submodule update --init libraries |
| 154 | + git submodule update --init --recursive mpl |
| 155 | +
|
| 156 | + - name: Configure AWS Credentials |
| 157 | + uses: aws-actions/configure-aws-credentials@v2 |
| 158 | + with: |
| 159 | + aws-region: us-west-2 |
| 160 | + role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2 |
| 161 | + role-session-name: RustTestVectors |
| 162 | + |
| 163 | + - name: Setup Rust Toolchain for GitHub CI |
| 164 | + uses: actions-rust-lang/[email protected] |
| 165 | + with: |
| 166 | + components: rustfmt |
| 167 | + # TODO - uncomment this after Rust formatter works |
| 168 | + # - name: Rustfmt Check |
| 169 | + # uses: actions-rust-lang/rustfmt@v1 |
| 170 | + |
| 171 | + - name: Setup Dafny |
| 172 | + uses: dafny-lang/[email protected] |
| 173 | + with: |
| 174 | + dafny-version: ${{ inputs.dafny }} |
| 175 | + |
| 176 | + # TODO: Remove this after the formatting in Rust starts working |
| 177 | + - name: smithy-dafny Rust hacks |
| 178 | + shell: bash |
| 179 | + run: | |
| 180 | + if [ "$RUNNER_OS" == "macOS" ]; then |
| 181 | + sed -i '' 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk |
| 182 | + else |
| 183 | + sed -i 's|rustfmt --edition 2021 runtimes/rust/src/implementation_from_dafny.rs|#&|' mpl/smithy-dafny/SmithyDafnyMakefile.mk |
| 184 | + fi |
| 185 | +
|
| 186 | + - name: Setup Java 17 for codegen |
| 187 | + uses: actions/setup-java@v3 |
| 188 | + with: |
| 189 | + distribution: "corretto" |
| 190 | + java-version: "17" |
| 191 | + |
| 192 | + - name: Setup NASM for Windows (aws-lc-sys) |
| 193 | + if: matrix.os == 'windows-latest' |
| 194 | + uses: ilammy/setup-nasm@v1 |
| 195 | + |
| 196 | + - name: Install Smithy-Dafny codegen dependencies |
| 197 | + uses: ./.github/actions/install_smithy_dafny_codegen_dependencies |
| 198 | + |
| 199 | + - name: Regenerate code using smithy-dafny if necessary |
| 200 | + if: ${{ inputs.regenerate-code }} |
| 201 | + uses: ./.github/actions/polymorph_codegen |
| 202 | + with: |
| 203 | + dafny: ${{ env.DAFNY_VERSION }} |
| 204 | + library: ${{ matrix.library }} |
| 205 | + diff-generated-code: false |
| 206 | + update-and-regenerate-mpl: true |
| 207 | + |
| 208 | + # TODO: Remove this after checking in Rust polymorph code |
| 209 | + # Also uncomment rust check_polymorph_diff for Rust in .github/actions/polymorph_codegen/action.yml |
| 210 | + - name: Run make polymorph_rust |
| 211 | + shell: bash |
| 212 | + working-directory: ${{ matrix.library }} |
| 213 | + run: | |
| 214 | + make polymorph_rust |
| 215 | +
|
| 216 | + - name: Compile ${{ matrix.library }} implementation |
| 217 | + shell: bash |
| 218 | + working-directory: ${{ matrix.library }} |
| 219 | + run: | |
| 220 | + # This works because `node` is installed by default on GHA runners |
| 221 | + CORES=$(node -e 'console.log(os.cpus().length)') |
| 222 | + make transpile_rust CORES=$CORES |
| 223 | +
|
| 224 | + - name: Unzip .NET Retry Flag Manifests |
| 225 | + shell: bash |
| 226 | + working-directory: TestVectors/dafny/TestVectors/test/ |
| 227 | + run: | |
| 228 | + unzip invalid-Net-4.0.0.zip -d invalid-Net-4.0.0 |
| 229 | + unzip v4-Net-4.0.1.zip -d v4-Net-4.0.1 |
| 230 | + unzip valid-Net-4.0.0.zip -d valid-Net-4.0.0 |
| 231 | +
|
| 232 | + - name: Test Rust |
| 233 | + working-directory: ${{ matrix.library }} |
| 234 | + shell: bash |
| 235 | + run: | |
| 236 | + # Without this, running test vectors fails due to `fatal runtime error: stack overflow` |
| 237 | + export RUST_MIN_STACK=104857600 |
| 238 | + make test_rust |
0 commit comments