Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
BUILD_CMD: swift build -c release
BENCH_CMD: .build/release/RegexBenchmark
BASELINE_FILE: benchmark-baseline
MAIN_FILE: benchmark-main
COMPARE_FILE: benchmark-pr
COMPARE_OUT_FILE: benchmark-results.txt
steps:
Expand All @@ -46,6 +47,26 @@ jobs:
set -euo pipefail
eval "$BENCH_CMD --save $RUNNER_TEMP/$BASELINE_FILE"
test -s "$RUNNER_TEMP/$BASELINE_FILE" || { echo "Baseline not created at $BASELINE_FILE"; exit 1; }
- name: Check out main branch
if: ${{ github.event.pull_request.base.ref != 'main' }}
uses: actions/checkout@v4
with:
ref: main
path: main-branch
fetch-depth: 0
- name: Build main branch
if: ${{ github.event.pull_request.base.ref != 'main' }}
working-directory: main-branch
run: |
set -euo pipefail
eval "$BUILD_CMD"
- name: Run main benchmark
if: ${{ github.event.pull_request.base.ref != 'main' }}
working-directory: main-branch
run: |
set -euo pipefail
eval "$BENCH_CMD --save $RUNNER_TEMP/$MAIN_FILE"
test -s "$RUNNER_TEMP/$MAIN_FILE" || { echo "Baseline (main) not created at $MAIN_FILE"; exit 1; }
- name: Check out PR branch
uses: actions/checkout@v4
with:
Expand All @@ -64,11 +85,17 @@ jobs:
eval "$BENCH_CMD --save $RUNNER_TEMP/$COMPARE_FILE"
test -s "$RUNNER_TEMP/$COMPARE_FILE" || { echo "Comparison not created at $COMPARE_FILE"; exit 1; }
eval "$BENCH_CMD --compare $RUNNER_TEMP/$BASELINE_FILE" | tee "$RUNNER_TEMP/$COMPARE_OUT_FILE"
- name: 📊 Compare benchmarks
- name: 📊 Compare benchmarks with base
working-directory: pr
run: |
set -euo pipefail
eval "$BENCH_CMD --load $RUNNER_TEMP/$COMPARE_FILE --compare $RUNNER_TEMP/$BASELINE_FILE --compare-compile-time $RUNNER_TEMP/$BASELINE_FILE" | tee "$RUNNER_TEMP/$COMPARE_OUT_FILE"
- name: 📊 Compare benchmarks with `main`
if: ${{ github.event.pull_request.base.ref != 'main' }}
working-directory: pr
run: |
set -euo pipefail
eval "$BENCH_CMD --load $RUNNER_TEMP/$COMPARE_FILE --compare $RUNNER_TEMP/$MAIN_FILE --compare-compile-time $RUNNER_TEMP/$MAIN_FILE"
- name: Upload benchmark artifacts
uses: actions/upload-artifact@v4
with:
Expand Down