Skip to content

Commit d6c62fb

Browse files
authored
chore: only run net48 on windows and use node 17 to run integration-node (#639)
1 parent efef497 commit d6c62fb

File tree

4 files changed

+279
-72
lines changed

4 files changed

+279
-72
lines changed
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# This workflow performs tests in .NET.
2+
name: Library net tests
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
dafny:
8+
description: 'The Dafny version to run'
9+
required: true
10+
type: string
11+
12+
env:
13+
# Used in examples
14+
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_KEY_ID: arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
15+
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_KEY_ID_2: arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
16+
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_MRK_KEY_ID: arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
17+
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_MRK_KEY_ID_2: arn:aws:kms:eu-west-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
18+
AWS_ENCRYPTION_SDK_EXAMPLE_LIMITED_ROLE_ARN_US_EAST_1: arn:aws:iam::370957321024:role/GitHub-CI-ESDK-Dafny-Role-us-west-2
19+
AWS_ENCRYPTION_SDK_EXAMPLE_LIMITED_ROLE_ARN_EU_WEST_1: arn:aws:iam::370957321024:role/GitHub-CI-ESDK-Dafny-Role-us-west-2
20+
# Used for Test Vectors
21+
VECTORS_URL: https://github.com/awslabs/aws-encryption-sdk-test-vectors/raw/master/vectors/awses-decrypt/python-2.3.0.zip
22+
23+
jobs:
24+
decrypt_python_vectors:
25+
strategy:
26+
matrix:
27+
os: [
28+
windows-latest,
29+
ubuntu-latest,
30+
macos-latest,
31+
]
32+
runs-on: ${{ matrix.os }}
33+
permissions:
34+
id-token: write
35+
contents: read
36+
env:
37+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
38+
DOTNET_NOLOGO: 1
39+
steps:
40+
- name: Support longpaths on Git checkout
41+
run: |
42+
git config --global core.longpaths true
43+
- uses: actions/checkout@v2
44+
- name: Init Submodules
45+
shell: bash
46+
run: |
47+
git submodule update --init libraries
48+
git submodule update --init --recursive mpl
49+
50+
- name: Configure AWS Credentials
51+
uses: aws-actions/configure-aws-credentials@v4
52+
with:
53+
aws-region: us-west-2
54+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
55+
role-session-name: NetTests
56+
57+
- name: Setup .NET Core SDK 6
58+
uses: actions/setup-dotnet@v3
59+
with:
60+
dotnet-version: '6.0.x'
61+
62+
- name: Setup Dafny
63+
uses: dafny-lang/[email protected]
64+
with:
65+
dafny-version: ${{ inputs.dafny }}
66+
67+
- name: Download Dependencies
68+
working-directory: ./AwsEncryptionSDK
69+
run: make setup_net
70+
71+
- name: Compile AwsEncryptionSDK implementation
72+
shell: bash
73+
working-directory: ./AwsEncryptionSDK
74+
run: |
75+
# This works because `node` is installed by default on GHA runners
76+
CORES=$(node -e 'console.log(os.cpus().length)')
77+
make transpile_net CORES=$CORES
78+
79+
- name: Fetch Python 2.3.0 Test Vectors
80+
working-directory: ./
81+
shell: bash
82+
run: |
83+
PYTHON_23_VECTOR_PATH=$GITHUB_WORKSPACE/python23/vectors
84+
mkdir -p $PYTHON_23_VECTOR_PATH
85+
DOWNLOAD_NAME=python23.zip
86+
curl --no-progress-meter --output $DOWNLOAD_NAME --location $VECTORS_URL
87+
unzip -o -qq $DOWNLOAD_NAME -d $PYTHON_23_VECTOR_PATH
88+
rm $DOWNLOAD_NAME
89+
90+
- name: Decrypt Python 2.3.0 Test Vectors on .net48 (Windows ONLY)
91+
working-directory: ./AwsEncryptionSDK/runtimes/net/TestVectorsNative/TestVectors
92+
if: matrix.os == 'windows-latest'
93+
shell: bash
94+
run: |
95+
PYTHON_23_VECTOR_PATH=$GITHUB_WORKSPACE/python23/vectors
96+
DAFNY_AWS_ESDK_TEST_VECTOR_MANIFEST_PATH="$PYTHON_23_VECTOR_PATH/manifest.json" \
97+
dotnet test --framework net48
98+
99+
- name: Decrypt Python 2.3.0 Test Vectors on .net6.0
100+
working-directory: ./AwsEncryptionSDK/runtimes/net/TestVectorsNative/TestVectors
101+
if: matrix.os != 'windows-latest'
102+
shell: bash
103+
run: |
104+
PYTHON_23_VECTOR_PATH=$GITHUB_WORKSPACE/python23/vectors
105+
if [ "$RUNNER_OS" == "macOS" ]; then
106+
DAFNY_AWS_ESDK_TEST_VECTOR_MANIFEST_PATH="$PYTHON_23_VECTOR_PATH/manifest.json" \
107+
DYLD_LIBRARY_PATH="/usr/local/opt/[email protected]/lib" \
108+
dotnet test --framework net6.0
109+
else
110+
DAFNY_AWS_ESDK_TEST_VECTOR_MANIFEST_PATH="$PYTHON_23_VECTOR_PATH/manifest.json" \
111+
dotnet test --framework net6.0
112+
fi
113+
114+
generate_vectors:
115+
strategy:
116+
matrix:
117+
os: [
118+
ubuntu-latest,
119+
macos-latest,
120+
]
121+
runs-on: ${{ matrix.os }}
122+
permissions:
123+
id-token: write
124+
contents: read
125+
env:
126+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
127+
DOTNET_NOLOGO: 1
128+
steps:
129+
- name: Support longpaths on Git checkout
130+
run: |
131+
git config --global core.longpaths true
132+
- uses: actions/checkout@v2
133+
- name: Init Submodules
134+
shell: bash
135+
run: |
136+
git submodule update --init libraries
137+
git submodule update --init --recursive mpl
138+
139+
- name: Configure AWS Credentials
140+
uses: aws-actions/configure-aws-credentials@v4
141+
with:
142+
aws-region: us-west-2
143+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
144+
role-session-name: NetTests
145+
146+
- name: Setup .NET Core SDK 6
147+
uses: actions/setup-dotnet@v3
148+
with:
149+
dotnet-version: '6.0.x'
150+
151+
- name: Setup Dafny
152+
uses: dafny-lang/[email protected]
153+
with:
154+
dafny-version: ${{ inputs.dafny }}
155+
156+
- name: Download Dependencies
157+
working-directory: ./AwsEncryptionSDK
158+
run: make setup_net
159+
160+
- name: Compile AwsEncryptionSDK implementation
161+
shell: bash
162+
working-directory: ./AwsEncryptionSDK
163+
run: |
164+
# This works because `node` is installed by default on GHA runners
165+
CORES=$(node -e 'console.log(os.cpus().length)')
166+
make transpile_net CORES=$CORES
167+
168+
169+
# # TODO: Fix Zip file creation on Windows
170+
# # - name: Zip the Generated Test Vectors for ESDK-JS on Windows
171+
# # if: matrix.os == 'windows-latest'
172+
# # shell: pwsh
173+
# # run: |
174+
# # # NET_41_VECTOR_PATH=$GITHUB_WORKSPACE/net41/vectors
175+
# # Set-Location -Path "$env:GITHUB_WORKSPACE\net41\vectors"
176+
# # Compress-Archive -Path "$env:GITHUB_WORKSPACE\net41\vectors\*" -DestinationPath "$env:GITHUB_WORKSPACE\net41\vectors\net41.zip"
177+
178+
179+
- name: Generate Test Vectors with .NET Framework net6.0
180+
# TODO Post-#619: Fix Zip file creation on Windows
181+
if: matrix.os != 'windows-latest'
182+
working-directory: ./AwsEncryptionSDK
183+
shell: bash
184+
run: |
185+
NET_41_VECTOR_PATH=net41/vectors
186+
mkdir -p $NET_41_VECTOR_PATH
187+
GEN_PATH=runtimes/net/TestVectorsNative/TestVectorGenerator
188+
dotnet run --project $GEN_PATH --framework net6.0 -- \
189+
--encrypt-manifest $GEN_PATH/resources/0006-awses-message-decryption-generation.v2.json \
190+
--output-dir $NET_41_VECTOR_PATH
191+
192+
- name: Zip the Generated Test Vectors for ESDK-JS on Mac/Linux
193+
if: matrix.os != 'windows-latest'
194+
working-directory: ./AwsEncryptionSDK
195+
shell: bash
196+
run: |
197+
NET_41_VECTOR_PATH=net41/vectors
198+
cd $NET_41_VECTOR_PATH
199+
zip -qq net41.zip -r .
200+
201+
- name: Upload Zip File
202+
uses: actions/upload-artifact@v4
203+
if: matrix.os != 'windows-latest'
204+
with:
205+
name: ${{matrix.os}}_vector_artifact
206+
path: AwsEncryptionSDK/net41/vectors/*.zip
207+
208+
decrypt_net_vectors_with_js:
209+
needs: generate_vectors
210+
strategy:
211+
matrix:
212+
os: [
213+
ubuntu-latest,
214+
macos-latest,
215+
]
216+
runs-on: ${{ matrix.os }}
217+
permissions:
218+
id-token: write
219+
contents: read
220+
steps:
221+
- name: Support longpaths on Git checkout
222+
run: |
223+
git config --global core.longpaths true
224+
- uses: actions/checkout@v2
225+
- name: Init Submodules
226+
shell: bash
227+
run: |
228+
git submodule update --init libraries
229+
git submodule update --init --recursive mpl
230+
231+
- name: Configure AWS Credentials
232+
uses: aws-actions/configure-aws-credentials@v4
233+
with:
234+
aws-region: us-west-2
235+
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Dafny-Role-us-west-2
236+
role-session-name: NetTests
237+
238+
- name: Set up Dirs
239+
working-directory: ./AwsEncryptionSDK
240+
run: |
241+
NET_41_VECTOR_PATH=AwsEncryptionSDK/net41/vectors
242+
mkdir -p $NET_41_VECTOR_PATH
243+
244+
- name: Download Encrypt Manifest Artifact
245+
uses: actions/download-artifact@v4
246+
with:
247+
name: ${{matrix.os}}_vector_artifact
248+
path: AwsEncryptionSDK/net41/vectors
249+
250+
- uses: actions/setup-node@v4
251+
with:
252+
node-version: 17
253+
254+
- name: Install deps
255+
run: |
256+
openssl version
257+
npm install @aws-crypto/integration-node
258+
npm install fast-xml-parser
259+
260+
- name: Decrypt Generated Test Vectors with ESDK-JS
261+
working-directory: ./AwsEncryptionSDK
262+
# TODO Post-#619: Fix Zip file creation on Windows
263+
shell: bash
264+
run: |
265+
NET_41_VECTOR_PATH=net41/vectors
266+
cd $NET_41_VECTOR_PATH
267+
npx -y @aws-crypto/integration-node decrypt -v net41.zip -c cpu -f 100
268+
269+

.github/workflows/library_net_tests.yml

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
7979
- name: Test .NET Framework net48
8080
working-directory: ./AwsEncryptionSDK
81+
if: matrix.os == 'windows-latest'
8182
shell: bash
8283
run: |
8384
make test_net FRAMEWORK=net48
@@ -94,6 +95,7 @@ jobs:
9495
9596
- name: Test Examples on .NET Framework net48
9697
working-directory: ./AwsEncryptionSDK
98+
if: matrix.os == 'windows-latest'
9799
shell: bash
98100
run: |
99101
dotnet test \
@@ -115,78 +117,6 @@ jobs:
115117
--framework net6.0
116118
fi
117119
118-
- name: Fetch awses-decrypt/python-2.3.0.zip
119-
working-directory: ./
120-
shell: bash
121-
run: |
122-
PYTHON_23_VECTOR_PATH=$GITHUB_WORKSPACE/python23/vectors
123-
mkdir -p $PYTHON_23_VECTOR_PATH
124-
DOWNLOAD_NAME=python23.zip
125-
curl --no-progress-meter --output $DOWNLOAD_NAME --location $VECTORS_URL
126-
unzip -o -qq $DOWNLOAD_NAME -d $PYTHON_23_VECTOR_PATH
127-
rm $DOWNLOAD_NAME
128-
129-
- name: Run Test Vectors on .NET Framework net48
130-
working-directory: ./AwsEncryptionSDK/runtimes/net/TestVectorsNative/TestVectors
131-
shell: bash
132-
run: |
133-
PYTHON_23_VECTOR_PATH=$GITHUB_WORKSPACE/python23/vectors
134-
DAFNY_AWS_ESDK_TEST_VECTOR_MANIFEST_PATH="$PYTHON_23_VECTOR_PATH/manifest.json" \
135-
dotnet test --framework net48
136-
137-
- name: Run Decrypt Test Vectors on .NET net6.0
138-
working-directory: ./AwsEncryptionSDK/runtimes/net/TestVectorsNative/TestVectors
139-
shell: bash
140-
run: |
141-
PYTHON_23_VECTOR_PATH=$GITHUB_WORKSPACE/python23/vectors
142-
if [ "$RUNNER_OS" == "macOS" ]; then
143-
DAFNY_AWS_ESDK_TEST_VECTOR_MANIFEST_PATH="$PYTHON_23_VECTOR_PATH/manifest.json" \
144-
DYLD_LIBRARY_PATH="/usr/local/opt/[email protected]/lib" \
145-
dotnet test --framework net6.0
146-
else
147-
DAFNY_AWS_ESDK_TEST_VECTOR_MANIFEST_PATH="$PYTHON_23_VECTOR_PATH/manifest.json" \
148-
dotnet test --framework net6.0
149-
fi
150-
151-
- name: Generate Test Vectors with .NET Framework net6.0
152-
# TODO Post-#619: Fix Zip file creation on Windows
153-
if: matrix.os != 'windows-latest'
154-
working-directory: ./AwsEncryptionSDK
155-
shell: bash
156-
run: |
157-
NET_41_VECTOR_PATH=$GITHUB_WORKSPACE/net41/vectors
158-
mkdir -p $NET_41_VECTOR_PATH
159-
GEN_PATH=runtimes/net/TestVectorsNative/TestVectorGenerator
160-
dotnet run --project $GEN_PATH --framework net6.0 -- \
161-
--encrypt-manifest $GEN_PATH/resources/0006-awses-message-decryption-generation.v2.json \
162-
--output-dir $NET_41_VECTOR_PATH
163-
164-
# TODO: Fix Zip file creation on Windows
165-
# - name: Zip the Generated Test Vectors for ESDK-JS on Windows
166-
# if: matrix.os == 'windows-latest'
167-
# shell: pwsh
168-
# run: |
169-
# # NET_41_VECTOR_PATH=$GITHUB_WORKSPACE/net41/vectors
170-
# Set-Location -Path "$env:GITHUB_WORKSPACE\net41\vectors"
171-
# Compress-Archive -Path "$env:GITHUB_WORKSPACE\net41\vectors\*" -DestinationPath "$env:GITHUB_WORKSPACE\net41\vectors\net41.zip"
172-
173-
- name: Zip the Generated Test Vectors for ESDK-JS on Mac/Linux
174-
if: matrix.os != 'windows-latest'
175-
shell: bash
176-
run: |
177-
NET_41_VECTOR_PATH=$GITHUB_WORKSPACE/net41/vectors
178-
cd $NET_41_VECTOR_PATH
179-
zip -qq net41.zip -r .
180-
181-
- name: Decrypt Generated Test Vectors with ESDK-JS
182-
# TODO Post-#619: Fix Zip file creation on Windows
183-
if: matrix.os != 'windows-latest'
184-
shell: bash
185-
run: |
186-
NET_41_VECTOR_PATH=$GITHUB_WORKSPACE/net41/vectors
187-
cd $NET_41_VECTOR_PATH
188-
npx -y @aws-crypto/integration-node decrypt -v $NET_41_VECTOR_PATH/net41.zip -c cpu
189-
190120
- name: Unzip ESDK-NET @ v4.0.0 Valid Vectors
191121
working-directory: ./AwsEncryptionSDK/runtimes/net/TestVectorsNative/TestVectors/resources
192122
shell: bash

.github/workflows/pull.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ jobs:
1717
uses: ./.github/workflows/library_net_tests.yml
1818
with:
1919
dafny: '4.2.0'
20+
pr-test-vectors:
21+
uses: ./.github/workflows/library_interop_tests.yml
22+
with:
23+
dafny: '4.2.0'

.github/workflows/push.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ jobs:
1919
uses: ./.github/workflows/library_net_tests.yml
2020
with:
2121
dafny: '4.2.0'
22+
pr-test-vectors:
23+
uses: ./.github/workflows/library_interop_tests.yml
24+
with:
25+
dafny: '4.2.0'

0 commit comments

Comments
 (0)