Skip to content

Commit fc5de82

Browse files
committed
Adding the PassKey sample test to all workflows.
Moving the Benchmark to only run on build as it makes no sense to run it on every pr.
1 parent e65b460 commit fc5de82

3 files changed

Lines changed: 158 additions & 106 deletions

File tree

.github/workflows/build.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,122 @@ jobs:
465465
run: |
466466
echo "Running PassKey test for ${{ env.databaseServerType }} ${{ env.databaseServerVersion }} (supports JSON)"
467467
dotnet run --project samples/PassKeyTest --no-build
468+
- name: Run Benchmarks
469+
# Benchmarks are enabled by default. Set enableBenchmarks=false in env to disable.
470+
if: ${{ env.skipTests != 'true' && github.event_name == 'pull_request' && env.enableBenchmarks == 'true' }}
471+
shell: pwsh
472+
run: |
473+
echo "Running performance benchmarks for ${{ env.databaseServerType }} ${{ env.databaseServerVersion }}"
474+
475+
# Set benchmark database connection environment variables
476+
$env:BENCHMARK_DB_HOST = "localhost"
477+
$env:BENCHMARK_DB_PORT = "3306"
478+
$env:BENCHMARK_DB_NAME = "pomelo_benchmark"
479+
$env:BENCHMARK_DB_USER = "root"
480+
$env:BENCHMARK_DB_PASSWORD = "Password12!"
481+
482+
# Change to benchmark directory so BenchmarkDotNet creates artifacts in the right location
483+
cd benchmark/EFCore.MySql.Benchmarks
484+
485+
# Run benchmark suite (quick mode for CI)
486+
dotnet run -c Release -- all
487+
488+
# Verify results were generated
489+
if (Test-Path "BenchmarkDotNet.Artifacts")
490+
{
491+
echo "Benchmark results generated successfully at: $(Get-Location)/BenchmarkDotNet.Artifacts"
492+
Get-ChildItem -Path "BenchmarkDotNet.Artifacts" -Recurse | Select-Object -First 10 | ForEach-Object { echo " $($_.FullName)" }
493+
}
494+
else
495+
{
496+
echo "WARNING: BenchmarkDotNet.Artifacts directory not found"
497+
}
498+
- name: Upload Benchmark Results
499+
if: ${{ env.skipTests != 'true' && github.event_name == 'pull_request' && env.enableBenchmarks == 'true' }}
500+
uses: actions/upload-artifact@v4
501+
with:
502+
name: benchmark-results-${{ matrix.dbVersion }}-${{ matrix.os }}
503+
path: benchmark/EFCore.MySql.Benchmarks/BenchmarkDotNet.Artifacts/**/*
504+
retention-days: 30
505+
506+
AggregateBenchmarkResults:
507+
name: Aggregate Benchmark Results
508+
needs: BuildAndTest
509+
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
510+
runs-on: ubuntu-latest
511+
steps:
512+
- name: Checkout
513+
uses: actions/checkout@v4
514+
515+
- name: Download All Benchmark Artifacts
516+
uses: actions/download-artifact@v4
517+
with:
518+
pattern: benchmark-results-*
519+
path: ./benchmark-artifacts
520+
521+
- name: List Downloaded Artifacts
522+
shell: pwsh
523+
run: |
524+
echo "Downloaded artifacts:"
525+
Get-ChildItem -Path ./benchmark-artifacts -Recurse | Select-Object -First 20 | ForEach-Object { echo " $($_.FullName)" }
526+
527+
- name: Aggregate Results and Update Documentation
528+
shell: pwsh
529+
run: |
530+
echo "Aggregating benchmark results..."
531+
532+
# Copy the original DatabaseVersions.md to working directory
533+
Copy-Item docs/DatabaseVersions.md ./DatabaseVersions-Updated.md
534+
535+
# Run aggregation script
536+
./scripts/aggregate-benchmark-results.ps1 -ArtifactsDir ./benchmark-artifacts -OutputFile ./DatabaseVersions-Updated.md
537+
538+
# Show diff
539+
echo ""
540+
echo "Changes made to DatabaseVersions.md:"
541+
git diff --no-index docs/DatabaseVersions.md ./DatabaseVersions-Updated.md || true
542+
543+
- name: Upload Updated Documentation
544+
uses: actions/upload-artifact@v4
545+
with:
546+
name: benchmark-summary-documentation
547+
path: ./DatabaseVersions-Updated.md
548+
retention-days: 30
549+
550+
- name: Upload Summary Comment
551+
shell: pwsh
552+
run: |
553+
# Create a summary markdown for the PR
554+
$summary = @"
555+
## 📊 Benchmark Results Summary
556+
557+
Benchmark results have been aggregated from all database versions.
558+
559+
**Download the updated documentation:**
560+
- Artifact: ``benchmark-summary-documentation``
561+
- File: ``DatabaseVersions-Updated.md``
562+
563+
The updated file includes actual benchmark timing data replacing the ``TIME_PLACEHOLDER`` markers.
564+
565+
### How to view results:
566+
1. Go to the Actions tab for this PR
567+
2. Find the workflow run
568+
3. Download the ``benchmark-summary-documentation`` artifact
569+
4. Review the updated ``DatabaseVersions-Updated.md`` file
570+
"@
571+
572+
echo $summary > benchmark-summary.md
573+
echo ""
574+
echo "Benchmark aggregation complete!"
575+
echo ""
576+
cat benchmark-summary.md
577+
578+
- name: Upload Summary as Artifact
579+
uses: actions/upload-artifact@v4
580+
with:
581+
name: benchmark-summary
582+
path: ./benchmark-summary.md
583+
retention-days: 30
468584
NuGet:
469585
needs: BuildAndTest
470586
if: (github.event_name == 'push' || github.event_name == 'release') && github.repository == 'PomeloFoundation/Pomelo.EntityFrameworkCore.MySql'

.github/workflows/pr-build.yml

Lines changed: 16 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -432,119 +432,29 @@ jobs:
432432
run: |
433433
$env:EF_DATABASE = "pomelo_test2"
434434
dotnet test -c Release --no-build --logger "GitHubActions;report-warnings=false" test/EFCore.MySql.IntegrationTests
435-
- name: Run Benchmarks
436-
# Benchmarks are enabled by default. Set enableBenchmarks=false in env to disable.
437-
if: ${{ env.skipTests != 'true' && github.event_name == 'pull_request' && env.enableBenchmarks == 'true' }}
435+
- name: PassKey Sample Test - Check JSON Support
436+
if: ${{ env.skipTests != 'true' }}
437+
id: check-json-support
438438
shell: pwsh
439439
run: |
440-
echo "Running performance benchmarks for ${{ env.databaseServerType }} ${{ env.databaseServerVersion }}"
441-
442-
# Set benchmark database connection environment variables
443-
$env:BENCHMARK_DB_HOST = "localhost"
444-
$env:BENCHMARK_DB_PORT = "3306"
445-
$env:BENCHMARK_DB_NAME = "pomelo_benchmark"
446-
$env:BENCHMARK_DB_USER = "root"
447-
$env:BENCHMARK_DB_PASSWORD = "Password12!"
448-
449-
# Change to benchmark directory so BenchmarkDotNet creates artifacts in the right location
450-
cd benchmark/EFCore.MySql.Benchmarks
451-
452-
# Run benchmark suite (quick mode for CI)
453-
dotnet run -c Release -- all
440+
# MySQL 5.7.8+ supports JSON, MariaDB 10.2.4+ supports JSON (through emulation)
441+
$dbVersion = [Version]'${{ env.databaseServerVersion }}'
442+
$supportsJson = $false
454443
455-
# Verify results were generated
456-
if (Test-Path "BenchmarkDotNet.Artifacts")
444+
if ('${{ env.databaseServerType }}' -eq 'mysql')
457445
{
458-
echo "Benchmark results generated successfully at: $(Get-Location)/BenchmarkDotNet.Artifacts"
459-
Get-ChildItem -Path "BenchmarkDotNet.Artifacts" -Recurse | Select-Object -First 10 | ForEach-Object { echo " $($_.FullName)" }
446+
$supportsJson = $dbVersion -ge [Version]'5.7.8'
460447
}
461-
else
448+
elseif ('${{ env.databaseServerType }}' -eq 'mariadb')
462449
{
463-
echo "WARNING: BenchmarkDotNet.Artifacts directory not found"
450+
$supportsJson = $dbVersion -ge [Version]'10.2.4'
464451
}
465-
- name: Upload Benchmark Results
466-
if: ${{ env.skipTests != 'true' && github.event_name == 'pull_request' && env.enableBenchmarks == 'true' }}
467-
uses: actions/upload-artifact@v4
468-
with:
469-
name: benchmark-results-${{ matrix.dbVersion }}-${{ matrix.os }}
470-
path: benchmark/EFCore.MySql.Benchmarks/BenchmarkDotNet.Artifacts/**/*
471-
retention-days: 30
472-
473-
AggregateBenchmarkResults:
474-
name: Aggregate Benchmark Results
475-
needs: BuildAndTest
476-
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
477-
runs-on: ubuntu-latest
478-
steps:
479-
- name: Checkout
480-
uses: actions/checkout@v4
481-
482-
- name: Download All Benchmark Artifacts
483-
uses: actions/download-artifact@v4
484-
with:
485-
pattern: benchmark-results-*
486-
path: ./benchmark-artifacts
487-
488-
- name: List Downloaded Artifacts
489-
shell: pwsh
490-
run: |
491-
echo "Downloaded artifacts:"
492-
Get-ChildItem -Path ./benchmark-artifacts -Recurse | Select-Object -First 20 | ForEach-Object { echo " $($_.FullName)" }
493-
494-
- name: Aggregate Results and Update Documentation
495-
shell: pwsh
496-
run: |
497-
echo "Aggregating benchmark results..."
498452
499-
# Copy the original DatabaseVersions.md to working directory
500-
Copy-Item docs/DatabaseVersions.md ./DatabaseVersions-Updated.md
501-
502-
# Run aggregation script
503-
./scripts/aggregate-benchmark-results.ps1 -ArtifactsDir ./benchmark-artifacts -OutputFile ./DatabaseVersions-Updated.md
504-
505-
# Show diff
506-
echo ""
507-
echo "Changes made to DatabaseVersions.md:"
508-
git diff --no-index docs/DatabaseVersions.md ./DatabaseVersions-Updated.md || true
509-
510-
- name: Upload Updated Documentation
511-
uses: actions/upload-artifact@v4
512-
with:
513-
name: benchmark-summary-documentation
514-
path: ./DatabaseVersions-Updated.md
515-
retention-days: 30
516-
517-
- name: Upload Summary Comment
453+
echo "supportsJson=$supportsJson" >> $env:GITHUB_OUTPUT
454+
echo "Database ${{ env.databaseServerType }} ${{ env.databaseServerVersion }} JSON support: $supportsJson"
455+
- name: PassKey Sample Test - Run Test
456+
if: ${{ env.skipTests != 'true' && steps.check-json-support.outputs.supportsJson == 'True' }}
518457
shell: pwsh
519458
run: |
520-
# Create a summary markdown for the PR
521-
$summary = @"
522-
## 📊 Benchmark Results Summary
523-
524-
Benchmark results have been aggregated from all database versions.
525-
526-
**Download the updated documentation:**
527-
- Artifact: ``benchmark-summary-documentation``
528-
- File: ``DatabaseVersions-Updated.md``
529-
530-
The updated file includes actual benchmark timing data replacing the ``TIME_PLACEHOLDER`` markers.
531-
532-
### How to view results:
533-
1. Go to the Actions tab for this PR
534-
2. Find the workflow run
535-
3. Download the ``benchmark-summary-documentation`` artifact
536-
4. Review the updated ``DatabaseVersions-Updated.md`` file
537-
"@
538-
539-
echo $summary > benchmark-summary.md
540-
echo ""
541-
echo "Benchmark aggregation complete!"
542-
echo ""
543-
cat benchmark-summary.md
544-
545-
- name: Upload Summary as Artifact
546-
uses: actions/upload-artifact@v4
547-
with:
548-
name: benchmark-summary
549-
path: ./benchmark-summary.md
550-
retention-days: 30
459+
echo "Running PassKey test for ${{ env.databaseServerType }} ${{ env.databaseServerVersion }} (supports JSON)"
460+
dotnet run --project samples/PassKeyTest --no-build

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,32 @@ jobs:
417417
run: |
418418
$env:EF_DATABASE = "pomelo_test2"
419419
dotnet test -c Release --no-build --logger "GitHubActions;report-warnings=false" test/EFCore.MySql.IntegrationTests
420+
- name: PassKey Sample Test - Check JSON Support
421+
if: ${{ env.skipTests != 'true' }}
422+
id: check-json-support
423+
shell: pwsh
424+
run: |
425+
# MySQL 5.7.8+ supports JSON, MariaDB 10.2.4+ supports JSON (through emulation)
426+
$dbVersion = [Version]'${{ env.databaseServerVersion }}'
427+
$supportsJson = $false
428+
429+
if ('${{ env.databaseServerType }}' -eq 'mysql')
430+
{
431+
$supportsJson = $dbVersion -ge [Version]'5.7.8'
432+
}
433+
elseif ('${{ env.databaseServerType }}' -eq 'mariadb')
434+
{
435+
$supportsJson = $dbVersion -ge [Version]'10.2.4'
436+
}
437+
438+
echo "supportsJson=$supportsJson" >> $env:GITHUB_OUTPUT
439+
echo "Database ${{ env.databaseServerType }} ${{ env.databaseServerVersion }} JSON support: $supportsJson"
440+
- name: PassKey Sample Test - Run Test
441+
if: ${{ env.skipTests != 'true' && steps.check-json-support.outputs.supportsJson == 'True' }}
442+
shell: pwsh
443+
run: |
444+
echo "Running PassKey test for ${{ env.databaseServerType }} ${{ env.databaseServerVersion }} (supports JSON)"
445+
dotnet run --project samples/PassKeyTest --no-build
420446
NuGet:
421447
needs: BuildAndTest
422448
if: github.repository == 'Microting/Pomelo.EntityFrameworkCore.MySql'

0 commit comments

Comments
 (0)