-
-
Notifications
You must be signed in to change notification settings - Fork 100
143 lines (123 loc) · 4.54 KB
/
benchmark.yaml
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
name: Benchmark Tests
on:
pull_request: ~
# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
TERM: xterm
jobs:
main-bench-test:
runs-on: ubuntu-latest
name: Benchmark main branch
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: phar.readonly=0, opcache.enable_cli=1
extensions: iconv, mbstring, opcache, :xdebug
tools: composer
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Ensure that the make target is up to date
run: make _vendor_install
- name: Install PHPBench Composer dependencies
uses: ./.github/actions/install-bench
- name: Run PHPBench
run: make phpbench_main
- uses: actions/upload-artifact@v4
name: Upload the Benchmark results
with:
name: bench-main-result
path: dist/bench-branch-main-result.xml
pr-bench-test:
runs-on: ubuntu-latest
name: Benchmark PR
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: phar.readonly=0, opcache.enable_cli=1
extensions: opcache, :xdebug
tools: composer
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Ensure that the make target is up to date
run: make _vendor_install
- name: Install PHPBench Composer dependencies
uses: ./.github/actions/install-bench
- name: Run PHPBench
run: make phpbench
# TODO: to enable back once figured out how to make it work. For some reasons no file report is created so
# no comparison is possible.
# pr-main-bench-test:
# runs-on: ubuntu-latest
# name: Benchmark PR compared to main
# needs: main-bench-test
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: '8.2'
# ini-values: phar.readonly=0, display_errors=On, error_reporting=-1
# tools: composer
# coverage: none
#
# - name: Install Composer dependencies
# uses: ramsey/composer-install@v3
#
# - name: Ensure that the make target is up to date
# run: make _vendor_install
#
# - name: Install PHPBench
# uses: ramsey/composer-install@v3
# with:
# working-directory: vendor-bin/phpbench
#
# - name: Ensure that the PHPBench make target is up to date
# run: make phpbench_install
#
# - name: Download the Benchmark results of the main branch
# uses: actions/download-artifact@v3
# with:
# name: bench-branch-main-result
#
# - name: Run PHPBench for PR branch
# run: make phpbench_pr
# This is a "trick", a meta task which does not change, and we can use in
# the protected branch rules as opposed to the tests one above which
# may change regularly.
validate-tests:
name: Benchmark tests status
runs-on: ubuntu-latest
needs:
- main-bench-test
- pr-bench-test
# - pr-main-bench-test
if: always()
steps:
- name: Successful run
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1