Skip to content

Commit 48f7f52

Browse files
committed
github-actions: Introduce benchmark workflow
1 parent ce0f4b9 commit 48f7f52

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Benchmark
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
benchmark:
10+
name: Benchmark
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Install PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
coverage: none
22+
php-version: "8.2"
23+
tools: composer:v2
24+
25+
- name: Composer install
26+
uses: ramsey/composer-install@v2
27+
with:
28+
composer-options: "--no-scripts"
29+
30+
# optionially ensure that the gh-pages branch exists. feel free to create
31+
# this yourself and ommit this step.
32+
- name: Ensure gh-pages branch exists
33+
run: |
34+
if ! git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then
35+
git config user.name "github-actions[bot]"
36+
git config user.email "12345678+github-actions[bot]@users.noreply.github.com"
37+
empty_tree="$(git hash-object -t tree /dev/null)"
38+
commit="$(git commit-tree "$empty_tree" -m 'Initial gh-pages branch')"
39+
git push origin "$commit:refs/heads/gh-pages"
40+
fi
41+
42+
- name: Run PHPBench
43+
run: bin/phpbench run --progress=plain --report=github-action-benchmark --output=json > output.json
44+
45+
- name: Store benchmark result
46+
uses: benchmark-action/github-action-benchmark@v1
47+
with:
48+
name: PHPBench Performance
49+
tool: customSmallerIsBetter
50+
output-file-path: output.json
51+
gh-pages-branch: gh-pages
52+
benchmark-data-dir-path: benchmarks
53+
auto-push: true
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+

0 commit comments

Comments
 (0)