Skip to content

Commit 8c63333

Browse files
committed
Add GitHub actions workflow for performance benchmarks
1 parent dc033ae commit 8c63333

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/benchmark.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "Performance Benchmark"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "v*.*"
7+
- "master"
8+
- "feature/*"
9+
paths-ignore:
10+
- "docs/**"
11+
push:
12+
branches:
13+
- "v*.*"
14+
- "master"
15+
- "feature/*"
16+
paths-ignore:
17+
- "docs/**"
18+
19+
env:
20+
PHP_VERSION: "8.2"
21+
DRIVER_VERSION: "stable"
22+
23+
jobs:
24+
psalm:
25+
name: "phpbench"
26+
runs-on: "ubuntu-22.04"
27+
28+
steps:
29+
- name: "Checkout"
30+
uses: "actions/checkout@v3"
31+
32+
- id: setup-mongodb
33+
uses: mongodb-labs/drivers-evergreen-tools@master
34+
with:
35+
version: "6.0"
36+
topology: "server"
37+
skip-legacy-shell: true
38+
39+
- name: Setup cache environment
40+
id: extcache
41+
uses: shivammathur/cache-extensions@v1
42+
with:
43+
php-version: ${{ env.PHP_VERSION }}
44+
extensions: "mongodb-${{ ENV.DRIVER_VERSION }}"
45+
key: "extcache-v1"
46+
47+
- name: Cache extensions
48+
uses: actions/cache@v3
49+
with:
50+
path: ${{ steps.extcache.outputs.dir }}
51+
key: ${{ steps.extcache.outputs.key }}
52+
restore-keys: ${{ steps.extcache.outputs.key }}
53+
54+
- name: "Install PHP"
55+
uses: "shivammathur/setup-php@v2"
56+
with:
57+
coverage: "none"
58+
extensions: "mongodb-${{ ENV.DRIVER_VERSION }}"
59+
php-version: "${{ env.PHP_VERSION }}"
60+
61+
- name: "Show driver information"
62+
run: "php --ri mongodb"
63+
64+
- name: "Install dependencies with Composer"
65+
uses: "ramsey/[email protected]"
66+
with:
67+
composer-options: "--no-suggest"
68+
69+
- name: "Run phpbench"
70+
run: "vendor/bin/phpbench run --config=phpbench.ci.json --report=aggregate --report=bar_chart_time --output html"
71+
72+
- name: Upload HTML report
73+
uses: actions/upload-artifact@v3
74+
with:
75+
name: phpbench-${{ github.sha }}.html
76+
path: .phpbench/html/index.html
77+
retention-days: 3

0 commit comments

Comments
 (0)