diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7ba86569..dd16e4ce 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -39,6 +39,9 @@ on: env: REPORT_FORMAT: ${{ (github.event_name == 'push' || github.event_name == 'pull_request' ) && 'json' || 'csv' }} + MAIN_BENCH_TASK: ${{ github.event.pull_request.number && 'prValidationBenchmark' || 'benchmark' }} + MAIN_BENCH_RESULTS: ${{ github.event.pull_request.number && 'prValidation' || 'main' }} + COMPARISON_BENCH_RESULTS: ${{ github.event.pull_request.number && 'prValidationComparison' || 'comparison' }} concurrency: cancel-in-progress: true @@ -50,13 +53,13 @@ jobs: matrix: include: - os: ubuntu-latest - additional-task: ':benchmark:jvmComparisonBenchmark' + additional-task: ":benchmark:${{ github.event.pull_request.number && 'jvmPrValidationComparisonBenchmark' || 'jvmComparisonBenchmark' }}" - os: macos-latest - additional-task: '-x :benchmark:jvmBenchmark' + additional-task: "-x :benchmark:${{ github.event.pull_request.number && 'jvmPrValidationBenchmark' || 'jvmBenchmark' }}" - os: macos-13 # for macosX64 - additional-task: '-x :benchmark:jvmBenchmark' + additional-task: "-x :benchmark:${{ github.event.pull_request.number && 'jvmPrValidationBenchmark' || 'jvmBenchmark' }}" - os: windows-latest - additional-task: '-x :benchmark:jvmBenchmark' + additional-task: "-x :benchmark:${{ github.event.pull_request.number && 'jvmPrValidationBenchmark' || 'jvmBenchmark' }}" runs-on: ${{ matrix.os }} name: Run benchmarks on ${{ matrix.os }} env: @@ -89,7 +92,7 @@ jobs: gradle-version: wrapper - name: Run benchmarks run: > - ./gradlew --no-daemon :benchmark:benchmark ${{ matrix.additional-task }} + ./gradlew --no-daemon :benchmark:${{ env.MAIN_BENCH_TASK }} ${{ matrix.additional-task }} -Pbenchmark_warmups=${{ inputs.warmups }} -Pbenchmark_iterations=${{ inputs.iterations }} -Pbenchmark_iteration_time=${{ inputs.iteration-time }} @@ -124,13 +127,13 @@ jobs: uses: actions/upload-artifact@v4 with: name: bench-result-${{ matrix.os }} - path: ${{ env.BENCHMARK_RESULTS }}/main/**/*.json + path: ${{ env.BENCHMARK_RESULTS }}/${{ env.MAIN_BENCH_RESULTS }}/**/*.json - name: Store comparison results as artifact if: env.REPORT_FORMAT == 'json' && matrix.os == 'ubuntu-latest' uses: actions/upload-artifact@v4 with: name: bench-comparison-result-${{ matrix.os }} - path: ${{ env.BENCHMARK_RESULTS }}/comparison/**/*.json + path: ${{ env.BENCHMARK_RESULTS }}/${{ env.COMPARISON_BENCH_RESULTS }}/**/*.json upload-benchmark-results: if: (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'OptimumCode/json-schema-validator' diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index b11ab446..d083493f 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -62,9 +62,15 @@ benchmark { getByName("main") { include(".*Common.*Bench.*") } + create("prValidation") { + include(".*CommonAvgTimeBench.*") + } create("comparison") { include(".*Comparison.*Benchmark.*") } + create("prValidationComparison") { + include(".*ComparisonAvgTimeBenchmark.*") + } } targets { register("jvm")