-
Notifications
You must be signed in to change notification settings - Fork 2
164 lines (141 loc) · 5.41 KB
/
benchmark.yml
File metadata and controls
164 lines (141 loc) · 5.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Performance Benchmark
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
pull-requests: write
deployments: write
concurrency:
group: benchmark-${{ github.ref }}
cancel-in-progress: true
env:
PHP_VERSION: '8.3'
BENCHMARK_DOCS: 10000
BENCHMARK_DIMS: 128
jobs:
# ─────────────────────────────────────────────────────────────────────────────
# PR Benchmark: Compare PR against base branch
# ─────────────────────────────────────────────────────────────────────────────
benchmark-pr:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: PR Performance Comparison
steps:
- name: Checkout PR branch
uses: actions/checkout@v5
with:
path: pr
- name: Checkout base branch
uses: actions/checkout@v5
with:
ref: ${{ github.base_ref }}
path: base
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
ini-values: memory_limit=1G
- name: Cache Composer packages (PR)
uses: actions/cache@v4
with:
path: pr/vendor
key: ${{ runner.os }}-php-${{ hashFiles('pr/**/composer.lock') }}
- name: Cache Composer packages (base)
uses: actions/cache@v4
with:
path: base/vendor
key: ${{ runner.os }}-php-${{ hashFiles('base/**/composer.lock') }}
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress --no-dev --working-dir=pr
composer install --prefer-dist --no-progress --no-dev --working-dir=base
- name: Run benchmark on base branch
run: |
php base/benchmark/run.php \
--profile=ci \
--scenarios=small \
--documents=${{ env.BENCHMARK_DOCS }} \
--dimensions=${{ env.BENCHMARK_DIMS }} \
--github-bench=base-benchmark.json
continue-on-error: true
- name: Run benchmark on PR branch
run: |
php pr/benchmark/run.php \
--profile=ci \
--scenarios=small \
--documents=${{ env.BENCHMARK_DOCS }} \
--dimensions=${{ env.BENCHMARK_DIMS }} \
--github-bench=pr-benchmark.json
- name: Compare benchmarks
uses: openpgpjs/github-action-pull-request-benchmark@v1
with:
name: PHPVector Performance
tool: customBiggerIsBetter
pr-benchmark-file-path: pr-benchmark.json
base-benchmark-file-path: base-benchmark.json
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true
alert-threshold: '90%'
fail-on-alert: false
fail-threshold: '80%'
- name: Upload benchmark artifacts
uses: actions/upload-artifact@v4
with:
name: benchmark-results-pr
path: |
pr-benchmark.json
base-benchmark.json
retention-days: 14
# ─────────────────────────────────────────────────────────────────────────────
# Main Benchmark: Store historical data and update graphs
# ─────────────────────────────────────────────────────────────────────────────
benchmark-main:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
name: Store Benchmark History
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
ini-values: memory_limit=1G
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-dev
- name: Run benchmark
run: |
php benchmark/run.php \
--profile=ci \
--scenarios=small \
--documents=${{ env.BENCHMARK_DOCS }} \
--dimensions=${{ env.BENCHMARK_DIMS }} \
--github-bench=benchmark-results.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: PHPVector Performance
tool: customBiggerIsBetter
output-file-path: benchmark-results.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
benchmark-data-dir-path: docs/benchmark
comment-on-alert: true
alert-threshold: '150%'
fail-on-alert: false
- name: Upload benchmark artifact
uses: actions/upload-artifact@v4
with:
name: benchmark-results-main
path: benchmark-results.json
retention-days: 90