-
Notifications
You must be signed in to change notification settings - Fork 28
130 lines (114 loc) · 3.85 KB
/
test-benchmark.yml
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
name: Benchmark Suite
on:
pull_request:
paths:
- '.github/workflows/benchmark-baseline.yml'
- '.github/workflows/test-benchmark.yml'
- 'src/adapter/**'
- 'src/core/**'
- 'src/lib/**'
- 'tools/phpbench/composer.lock'
- 'composer.lock'
# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
benchmark:
name: "Benchmark"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
dependencies:
- "locked"
php-version:
- "8.1"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: none
tools: composer:v2
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
extensions: :psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib
- name: "Get Composer Cache Directory"
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer dependencies"
uses: "actions/cache@v4"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ matrix.php-version }}-locked-composer-
- name: "Install locked dependencies"
run: "composer install --no-interaction --no-progress"
- name: "Download phpbench benchmarks artifact"
uses: dawidd6/action-download-artifact@v6
with:
workflow: benchmark-baseline.yml
name: phpbench-baseline
path: ./var/phpbench/
- name: "Execute benchmarks"
id: init_comment
run: |
{
echo '# Flow PHP - Benchmarks'
echo '<sup><sub>Results of the benchmarks from this PR are compared with the results from 1.x branch.</sub></sup>'
echo ' '
echo '<details><summary>Extractors</summary>'
echo ' '
echo '```shell'
composer test:benchmark:extractor -- --ref=1.x --progress=none
echo '```'
echo ' '
echo '</details>'
echo ' '
echo '<details><summary>Transformers</summary>'
echo ' '
echo '```shell'
composer test:benchmark:transformer -- --ref=1.x --progress=none
echo '```'
echo ' '
echo '</details>'
echo ' '
echo '<details><summary>Loaders</summary>'
echo ' '
echo '```shell'
composer test:benchmark:loader -- --ref=1.x --progress=none
echo '```'
echo ' '
echo '</details>'
echo ' '
echo '<details><summary>Building Blocks</summary>'
echo ' '
echo '```shell'
composer test:benchmark:building_blocks -- --ref=1.x --progress=none
echo '```'
echo ' '
echo '</details>'
echo ' '
} >> "./var/phpbench/summary.txt"
- uses: actions/upload-artifact@v4
with:
name: phpbench
path: ./var/phpbench/summary.txt
overwrite: true
- name: Save PR number
run: echo ${{ github.event.pull_request.number }} > ./pr-id.txt
- name: Upload PR number
uses: actions/upload-artifact@v4
with:
name: pr
path: ./pr-id.txt
overwrite: true
- name: "Set job summary"
run: |
echo "${{ env.COMMENT_CONTENT }}" >> $GITHUB_STEP_SUMMARY