-
Notifications
You must be signed in to change notification settings - Fork 11
332 lines (310 loc) · 12.1 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
name: Tests
on:
pull_request:
push:
branches:
- main
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test API
strategy:
fail-fast: false
matrix:
language:
- lang: C#
cmd: dotnet test -f net4.7 --logger "trx;LogFileName=test-results.trx"
dir: csharp/ArmoniK.Api.Client.Test
dotnet: ''
env: {}
- lang: C#
cmd: dotnet test -f net4.7 --logger "trx;LogFileName=test-results.trx"
dir: csharp/ArmoniK.Api.Client.Test
dotnet: ''
env:
GrpcClient__HttpMessageHandler: GrpcWebHandler
- lang: C#
cmd: dotnet test -f net4.8 --logger "trx;LogFileName=test-results.trx"
dir: csharp/ArmoniK.Api.Client.Test
dotnet: ''
env: {}
- lang: C#
cmd: dotnet test -f net4.8 --logger "trx;LogFileName=test-results.trx"
dir: csharp/ArmoniK.Api.Client.Test
dotnet: ''
env:
GrpcClient__HttpMessageHandler: GrpcWebHandler
- lang: C#
cmd: dotnet test -f net6.0 --logger "trx;LogFileName=test-results.trx"
dir: csharp/ArmoniK.Api.Client.Test
dotnet: 6.0
env: {}
- lang: C#
cmd: dotnet test -f net8.0 --logger "trx;LogFileName=test-results.trx"
dir: csharp/ArmoniK.Api.Client.Test
dotnet: 8.0
env: {}
- lang: C++
cmd: ./tools/run_test.sh
dir: cpp
env: {}
- lang: Python
cmd: pytest tests --cov=armonik --cov-config=.coveragerc --cov-report=term-missing --cov-append --cov-report xml:coverage.xml --cov-report html:coverage_report
dir: python
env: {}
- lang: Rust
toolchain: stable
cmd: cargo test --locked
dir: rust/armonik
env: {}
- lang: Rust
toolchain: nightly
cmd: cargo test --locked
dir: rust/armonik
env: {}
plateform:
- os: ubuntu-latest
- os: windows-latest
- os: windows-2019
exclude:
- language:
lang: Python
plateform:
os: windows-latest
- language:
lang: C++
plateform:
os: windows-latest
- language:
lang: C++
plateform:
os: windows-2019
- language:
lang: Python
plateform:
os: windows-2019
- language:
lang: Rust
plateform:
os: windows-2019
- language:
lang: C#
dotnet: ''
plateform:
os: ubuntu-latest
runs-on: ${{ matrix.plateform.os }}
env: ${{ matrix.language.env }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Generate certs
working-directory: packages/csharp/
shell: bash
run: |
mkdir certs
cd certs
../../../scripts/certs.sh
- name: Install certs
if: ${{ matrix.plateform.os == 'ubuntu-latest' }}
working-directory: packages/csharp/certs
run: |
sudo apt install ca-certificates
sudo mkdir -p /usr/local/share/ca-certificates/
sudo cp server2-ca.pem /usr/local/share/ca-certificates/ca.crt
sudo update-ca-certificates
- name: Install certs
if: ${{ contains(matrix.plateform.os, 'windows') }}
working-directory: packages/csharp/certs
run: |
certutil -addstore -f "ROOT" server2-ca.pem
- name: Install .NET Core
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4
if: ${{ matrix.language.dotnet }} != ""
with:
dotnet-version: ${{ matrix.language.dotnet }}
- name: Print language
run: |
echo "Current language: ${{ matrix.language.lang }}"
# Prepare Python
- name: pip update and add build package
if: ${{ matrix.language.lang == 'Python' }}
working-directory: packages/python
run: bash proto2python.sh ~/pyvenv
- name: Install python dependencies
if: ${{ matrix.language.lang == 'Python' }}
working-directory: packages/python
run: |
pwd
pip install "$(echo pkg/armonik*.whl)[tests]"
# Prepare Rust
- uses: taiki-e/install-action@9023ed54c080c7ff1b3e4af335c729c3f9cb1dd7 # v2
if: ${{ matrix.language.lang == 'Rust' }}
with:
tool: protoc,sccache
- name: Install Rust toolchain
if: ${{ matrix.language.lang == 'Rust' }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.language.toolchain }}
components: rust-src,rust-docs,rustfmt${{contains(matrix.language.toolchain, 'nightly') && ',miri' || ''}}
- name: Build Rust package
if: ${{ matrix.language.lang == 'Rust' }}
working-directory: packages/rust/armonik
run: |
cargo build --locked --tests
# Prepare C++
- name: Build C++ package
if: ${{ matrix.language.lang == 'C++' }}
working-directory: packages/cpp
run: |
./tools/build_test.sh
- name: Build Mock server
working-directory: packages/csharp/ArmoniK.Api.Mock
shell: bash
run: |
dotnet publish -o ../out
[ -e ../out/ArmoniK.Api.Mock.exe ] || ln -s ArmoniK.Api.Mock ../out/ArmoniK.Api.Mock.exe
# Run tests
- name: noTLS
working-directory: packages/csharp/
shell: bash
run: |
export Grpc__Port=5000
export Http__Port=4999
export Grpc__Endpoint=http://localhost:5000
export Http__Endpoint=http://localhost:4999
export GrpcClient__Endpoint=http://localhost:5000
export GrpcClient__AllowUnsafeConnection=true
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: TLS Insecure
if: ${{ contains(fromJson('["C#", "Rust"]'), matrix.language.lang) }}
working-directory: packages/csharp/
shell: bash
run: |
export Grpc__Port=5001
export Http__Port=5001
export Http__Cert=certs/server1.pem
export Http__Key=certs/server1.key
export Grpc__Endpoint=https://localhost:5001
export Http__Endpoint=https://localhost:5001
export Grpc__AllowUnsafeConnection=true
export GrpcClient__Endpoint=https://localhost:5001
export GrpcClient__AllowUnsafeConnection=true
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: TLS secure
working-directory: packages/csharp/
shell: bash
run: |
export CertFolder="$PWD/certs"
export Grpc__Port=5001
export Http__Port=5001
export Http__Cert=certs/server1.pem
export Http__Key=certs/server1.key
export Grpc__Endpoint=https://localhost:5001
export Http__Endpoint=https://localhost:5001
export Grpc__CaCert=certs/server1-ca.pem
export GrpcClient__Endpoint=https://localhost:5001
export GrpcClient__AllowUnsafeConnection=false
export GrpcClient__CaCert=$CertFolder/server1-ca.pem
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: TLS store
working-directory: packages/csharp/
shell: bash
run: |
export Grpc__Port=5002
export Http__Port=5002
export Http__Cert=certs/server2.pem
export Http__Key=certs/server2.key
export Grpc__Endpoint=https://localhost:5002
export Http__Endpoint=https://localhost:5002
export GrpcClient__Endpoint=https://localhost:5002
export GrpcClient__AllowUnsafeConnection=false
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: mTLS Insecure
if: ${{ contains(fromJson('["C#", "Rust"]'), matrix.language.lang) }}
working-directory: packages/csharp/
shell: bash
run: |
export CertFolder="$PWD/certs"
export Grpc__Port=5003
export Http__Port=5003
export Http__Cert=certs/server1.pem
export Http__Key=certs/server1.key
export Grpc__Endpoint=https://localhost:5003
export Http__Endpoint=https://localhost:5003
export Grpc__ClientCert=certs/client.pem
export Grpc__ClientKey=certs/client.key
export GrpcClient__Endpoint=https://localhost:5003
export GrpcClient__AllowUnsafeConnection=true
export GrpcClient__CertPem=$CertFolder/client.pem
export GrpcClient__KeyPem=$CertFolder/client.key
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: mTLS secure
working-directory: packages/csharp/
shell: bash
run: |
export CertFolder="$PWD/certs"
export Grpc__Port=5003
export Http__Port=5003
export Http__Cert=certs/server1.pem
export Http__Key=certs/server1.key
export Http__ClientCert=certs/client-ca.pem
export Grpc__Endpoint=https://localhost:5003
export Http__Endpoint=https://localhost:5003
export Grpc__CaCert=certs/server1-ca.pem
export Grpc__ClientCert=certs/client.pem
export Grpc__ClientKey=certs/client.key
export GrpcClient__Endpoint=https://localhost:5003
export GrpcClient__AllowUnsafeConnection=false
export GrpcClient__CaCert=$CertFolder/server1-ca.pem
export GrpcClient__CertPem=$CertFolder/client.pem
export GrpcClient__KeyPem=$CertFolder/client.key
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: mTLS store
working-directory: packages/csharp/
shell: bash
run: |
export CertFolder="$PWD/certs"
export Grpc__Port=5004
export Http__Port=5004
export Http__Cert=certs/server2.pem
export Http__Key=certs/server2.key
export Http__ClientCert=certs/client-ca.pem
export Grpc__Endpoint=https://localhost:5004
export Http__Endpoint=https://localhost:5004
export Grpc__ClientCert=certs/client.pem
export Grpc__ClientKey=certs/client.key
export GrpcClient__Endpoint=https://localhost:5004
export GrpcClient__AllowUnsafeConnection=false
export GrpcClient__CertPem=$CertFolder/client.pem
export GrpcClient__KeyPem=$CertFolder/client.key
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: Test Report
uses: dorny/test-reporter@v1
if: ${{ matrix.language.lang == 'C#' && always() }}
with:
name: ConnectivityTests ${{ matrix.plateform.os }} ${{ matrix.dotnet.framework }} ${{ matrix.language.handler }}
path: ./packages/csharp/ArmoniK.Api.Client.Test/TestResults/test-results.trx
reporter: dotnet-trx
- name: Get Cover Python
uses: orgoro/coverage@3f13a558c5af7376496aa4848bf0224aead366ac
if: ${{ matrix.language.lang == 'Python' && always() }}
with:
coverageFile: packages/python/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: Archive code coverage results html
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
if: ${{ matrix.language.lang == 'Python' && always() }}
with:
name: code-coverage-report-html
path: packages/python/coverage_report
- name: Archive code coverage results xml
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
if: ${{ matrix.language.lang == 'Python' && always() }}
with:
name: code-coverage-report-xml
path: packages/python/coverage.xml