test: Adding rpcs test to csharp #985
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {} | |
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: C# | |
dotnet: '' | |
plateform: | |
os: ubuntu-latest | |
runs-on: ${{ matrix.plateform.os }} | |
env: ${{ matrix.language.env }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 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@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4 | |
if: ${{ matrix.language.dotnet }} != "" | |
with: | |
dotnet-version: ${{ matrix.language.dotnet }} | |
- name: Print language | |
run: | | |
echo "Current language: ${{ matrix.language.lang }}" | |
- 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]" | |
- 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 | |
- 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: ${{ matrix.language.lang == 'C#' }} | |
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 | |
export Grpc__SSLValidation=enable | |
../../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 | |
export Grpc__SSLValidation=enable | |
../../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 | |
export Grpc__SSLValidation=enable | |
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}' | |
- name: mTLS Insecure | |
if: ${{ matrix.language.lang == 'C#' }} | |
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 | |
export Grpc__SSLValidation=enable | |
export Grpc__mTLS=true | |
../../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 | |
export Grpc__SSLValidation=enable | |
export Grpc__mTLS=true | |
../../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 | |
export Grpc__SSLValidation=enable | |
export Grpc__mTLS=true | |
../../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@834a144ee995460fba8ed112a2fc961b36a5ec5a | |
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@834a144ee995460fba8ed112a2fc961b36a5ec5a | |
if: ${{ matrix.language.lang == 'Python' && always() }} | |
with: | |
name: code-coverage-report-xml | |
path: packages/python/coverage.xml |