-
-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (66 loc) · 2.24 KB
/
bechmark.yml
File metadata and controls
75 lines (66 loc) · 2.24 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
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'
- 'tests/**'
push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'
- 'tests/**'
name: bechmark
jobs:
phpbench:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- 81
- 82
- 83
- 84
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if we need to create a baseline for a PR
run: |
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.ref }}" != "refs/heads/${{ github.event.repository.default_branch }}" ]]; then
echo "WITH_BENCH_BASELINE=1" >> $GITHUB_ENV
else
echo "WITH_BENCH_BASELINE=0" >> $GITHUB_ENV
fi
- name: "Baseline creation: Checkout default branch."
uses: actions/checkout@v4
if: ${{ env.WITH_BENCH_BASELINE == '1' }}
with:
ref: ${{ github.event.repository.default_branch }}
- name: Build
if: ${{ env.WITH_BENCH_BASELINE == '1' }}
working-directory: ./tests
run: docker compose build php${{ matrix.php }}
- name: "Baseline creation: Run PhpBench."
if: ${{ env.WITH_BENCH_BASELINE == '1' }}
run: docker compose run --rm -e XDEBUG_MODE=off php${{ matrix.php }} php vendor/bin/phpbench run --report='aggregate' --tag=default
working-directory: ./tests
- name: "Run PhpBench."
working-directory: ./tests
run: |
if [ "${{ env.WITH_BENCH_BASELINE }}" == '1' ]; then
docker compose run --rm -e XDEBUG_MODE=off php${{ matrix.php }} php vendor/bin/phpbench run --report='aggregate' --ref=default --assert="mode(variant.time.avg) <= mode(baseline.time.avg) +/- 5%" > phpbench.log
else
docker compose run --rm -e XDEBUG_MODE=off php${{ matrix.php }} php vendor/bin/phpbench run --report='aggregate' > phpbench.log
fi