File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1919 license_header_check_project_name : " Swift.org"
2020 unacceptable_language_check_enabled : false
2121 format_check_enabled : false
22+ bench :
23+ name : Benchmark
24+ runs-on : ubuntu-latest
25+ env :
26+ BUILD_CMD : swift build -c release
27+ BENCH_CMD : .build/release/RegexBenchmark
28+ BASELINE_FILE : benchmark-baseline
29+ COMPARE_OUT_FILE : benchmark-results.txt
30+ steps :
31+ - name : Check out PR branch
32+ uses : actions/checkout@v4
33+ with :
34+ ref : ${{ github.event.pull_request.head.sha }}
35+ path : pr
36+ fetch-depth : 0
37+ - name : Check out baseline branch
38+ uses : actions/checkout@v4
39+ with :
40+ ref : ${{ github.event.pull_request.base.sha }}
41+ path : base
42+ fetch-depth : 0
43+ - name : Build baseline
44+ working-directory : base
45+ run : |
46+ set -euo pipefail
47+ eval "$BUILD_CMD"
48+ - name : Run baseline benchmark
49+ working-directory : base
50+ run : |
51+ set -euo pipefail
52+ eval "$BENCH_CMD --save $RUNNER_TEMP/$BASELINE_FILE"
53+ test -s "$RUNNER_TEMP/$BASELINE_FILE" || { echo "Baseline not created at $BASELINE_FILE"; exit 1; }
54+ - name : Build PR
55+ working-directory : pr
56+ run : |
57+ set -euo pipefail
58+ eval "$BUILD_CMD"
59+ - name : Run comparison benchmark (PR vs baseline)
60+ working-directory : pr
61+ run : |
62+ set -euo pipefail
63+ eval "$BENCH_CMD --compare $RUNNER_TEMP/$BASELINE_FILE" | tee "$RUNNER_TEMP/$COMPARE_OUT_FILE"
64+ - name : Upload benchmark artifacts
65+ uses : actions/upload-artifact@v4
66+ with :
67+ name : benchmark-results
68+ path : |
69+ ${{ env.RUNNER_TEMP }}/${{ env.BASELINE_FILE }}
70+ ${{ env.RUNNER_TEMP }}/${{ env.COMPARE_OUT_FILE }}
You can’t perform that action at this time.
0 commit comments