Add: functional test results summary #8895
Workflow file for this run
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| # For detect flaky tests | |
| schedule: | |
| - cron: "45 * * * *" | |
| jobs: | |
| ydb-sdk-tests: | |
| strategy: | |
| matrix: | |
| ydb-version: [ 'latest', '25.1' ] | |
| dotnet-version: [ 8.0.x, 9.0.x ] | |
| runs-on: ubuntu-22.04 | |
| services: | |
| ydb: | |
| image: ydbplatform/local-ydb:${{ matrix.ydb-version }} | |
| ports: [ "2135:2135", "2136:2136", "8765:8765" ] | |
| env: | |
| YDB_LOCAL_SURVIVE_RESTART: true | |
| options: '--name ydb-local -h localhost' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet-version }} | |
| - name: Run ADO.NET Tests | |
| working-directory: ./src/Ydb.Sdk/test/Ydb.Sdk.Ado.Tests | |
| run: | | |
| docker cp ydb-local:/ydb_certs/ca.pem ~/ | |
| dotnet test \ | |
| --logger "GitHubActions;report-warnings=false" \ | |
| --logger "trx;LogFileName=ado.trx" \ | |
| --results-directory "$PWD" | |
| continue-on-error: true | |
| - name: Run ADO.NET Specification Tests | |
| working-directory: ./src/Ydb.Sdk/test/Ydb.Sdk.Ado.Specification.Tests | |
| run: | | |
| dotnet test \ | |
| --logger "GitHubActions;report-warnings=false" \ | |
| --logger "trx;LogFileName=spec.trx" \ | |
| --results-directory "$PWD" | |
| continue-on-error: true | |
| - name: Run ADO.NET Dapper Tests | |
| working-directory: ./src/Ydb.Sdk/test/Ydb.Sdk.Ado.Dapper.Tests | |
| run: | | |
| dotnet test \ | |
| --logger "GitHubActions;report-warnings=false" \ | |
| --logger "trx;LogFileName=dapper.trx" \ | |
| --results-directory "$PWD" | |
| continue-on-error: true | |
| - name: Run Topic Tests | |
| working-directory: ./src/Ydb.Sdk/test/Ydb.Sdk.Topic.Tests | |
| run: | | |
| dotnet test \ | |
| --logger "GitHubActions;report-warnings=false" \ | |
| --logger "trx;LogFileName=topic.trx" \ | |
| --results-directory "$PWD" | |
| continue-on-error: true | |
| - name: Publish combined test summary table | |
| if: always() | |
| run: | | |
| echo '| Test Suite | ✓ Passed | ✗ Failed | ↻ Skipped | ∑ Total | ⏱ Elapsed |' >> $GITHUB_STEP_SUMMARY | |
| echo '|:---------- | -------: | -------: | --------: | ------: | --------: |' >> $GITHUB_STEP_SUMMARY | |
| summarize () { | |
| local name="$1"; local expected="$2" | |
| local path="$expected" | |
| if [ ! -f "$path" ]; then | |
| local base_dir; base_dir="$(dirname "$expected")" | |
| path=$(find "$base_dir" -maxdepth 3 -type f -name '*.trx' -print -quit 2>/dev/null || true) | |
| fi | |
| if [ -f "$path" ]; then | |
| local passed failed skipped total duration | |
| passed=$(grep -oP 'passed="\K\d+' "$path" | head -1 || echo 0) | |
| failed=$(grep -oP 'failed="\K\d+' "$path" | head -1 || echo 0) | |
| skipped=$(grep -oP 'skipped="\K\d+' "$path" | head -1 || echo 0) | |
| total=$(grep -oP 'total="\K\d+' "$path" | head -1 || echo 0) | |
| duration=$(grep -oP 'duration="\K[0-9\.]+' "$path" | head -1 || true) | |
| if [ -z "$duration" ]; then | |
| local start finish | |
| start=$(grep -oP '<Times[^>]*start="\K[^"]+' "$path" | head -1 || true) | |
| finish=$(grep -oP '<Times[^>]*finish="\K[^"]+' "$path" | head -1 || true) | |
| if [ -n "$start" ] && [ -n "$finish" ]; then | |
| local ds df | |
| ds=$(date -u -d "$start" +%s 2>/dev/null || true) | |
| df=$(date -u -d "$finish" +%s 2>/dev/null || true) | |
| if [ -n "$ds" ] && [ -n "$df" ]; then | |
| duration=$((df-ds)) | |
| fi | |
| fi | |
| fi | |
| [ -z "$duration" ] && duration='-' | |
| echo "| $name | $passed | $failed | $skipped | $total | ${duration}s |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| $name | N/A | N/A | N/A | N/A | N/A |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| } | |
| summarize 'ADO.NET' './src/Ydb.Sdk/test/Ydb.Sdk.Ado.Tests/ado.trx' | |
| summarize 'Specification' './src/Ydb.Sdk/test/Ydb.Sdk.Ado.Specification.Tests/spec.trx' | |
| summarize 'Dapper' './src/Ydb.Sdk/test/Ydb.Sdk.Ado.Dapper.Tests/dapper.trx' | |
| summarize 'Topic' './src/Ydb.Sdk/test/Ydb.Sdk.Topic.Tests/topic.trx' | |
| run-examples: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ydb-version: [ 'latest', 'trunk' ] | |
| dotnet-version: [ 8.0.x, 9.0.x ] | |
| services: | |
| ydb: | |
| image: ydbplatform/local-ydb:${{ matrix.ydb-version }} | |
| ports: | |
| - 2135:2135 | |
| - 2136:2136 | |
| - 8765:8765 | |
| env: | |
| YDB_LOCAL_SURVIVE_RESTART: true | |
| YDB_USE_IN_MEMORY_PDISKS: true | |
| options: '--name ydb-local -h localhost' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet-version }} | |
| - name: Run Ydb.Sdk.AdoNet.QuickStart | |
| run: | | |
| docker cp ydb-local:/ydb_certs/ca.pem ~/ | |
| cd ./examples/Ydb.Sdk.AdoNet.QuickStart | |
| dotnet run | |
| - name: Run Ydb.Sdk.AdoNet.Dapper.QuickStart | |
| run: | | |
| cd ./examples/Ydb.Sdk.AdoNet.Dapper.QuickStart | |
| dotnet run | |
| - name: Run Ydb.Sdk.Topic.QuickStart | |
| run: | | |
| cd ./examples/Ydb.Sdk.Topic.QuickStart | |
| dotnet run | |
| - name: Run EntityFrameworkCore.Ydb.QuickStart | |
| run: | | |
| cd ./examples/EntityFrameworkCore.Ydb.QuickStart | |
| dotnet tool install --global dotnet-ef | |
| dotnet add package Microsoft.EntityFrameworkCore.Design | |
| dotnet ef migrations add InitialCreate | |
| dotnet ef database update | |
| dotnet run | |
| - name: Run EntityFrameworkCore.Ydb.Samples/Database.Operations.Tutorial | |
| run: | | |
| cd ./examples/EntityFrameworkCore.Ydb.Samples/Database.Operations.Tutorial | |
| dotnet tool install --global dotnet-ef | |
| dotnet add package Microsoft.EntityFrameworkCore.Design | |
| dotnet ef migrations add InitialCreate | |
| dotnet ef database update | |
| dotnet run |